
Change the aspect ratio of an image using CSS
24/09/2021In this post I'll show you how to change the aspect ratio of an image or element using CSS, and explain why this is important.
Once upon a time in a town called Tiverton, I decided to start a blog. Gav’s Blog would be a treasure trove of web developer tutorials, tips and tricks covering a wide range of subjects such as JavaScript, WordPress, HTML, CSS and PHP. A lightbulb of inspiration, it would draw a wide range of developers from all around the globe. Helping others find answers to all kinds of programmy problems…
We all have dreams and this is one of mine. I hope you enjoy the ride…
This is the blog of Gavin de Ste Croix and here’s what I’ve got so far:
In this post I'll show you how to change the aspect ratio of an image or element using CSS, and explain why this is important.
Here is how you can fix node incompatibility error, using "Node Sass does not yet support your current environment" as an example.
Need to make a directory in PHP? No Problem! mkdir has you covered... Need to recursively make directories in PHP? mkdir has you covered, too!
You probably know a few tricks for changing bullet colour and icon of a html list element using CSS, but this one might be new!
Let's look at how to create and register our own custom image and thumbnail sizes and use them within our WordPress posts and pages.
Need to find a directory path relative to your current file? This is how we use dirname() and realpath() to move up directory levels in PHP.
Learn how to regenerate and update WordPress media and image sizes both programmatically (without plugin), and also with a handy plugin.
Ever seen constants like __DIR__ and __FILE__ being used in PHP? These are 'Magic Constants', and this is how we can use them.
Learn how to use event listeners to detect and handle single and multiple keypress events in JavaScript. Add modifier keys to your application!