Automatically Scale Images with CSS

So you’ve just made a blog, and you’re making your first post. You want to display an image that fits your WordPress theme, but you don’t want to spend the time resizing it in Photoshop. Well, we’ve got a useful trick for you. A small and easy bit of code that will evenly resize your images with nothing but CSS.

The code:


img {
max-width: DESIRED WIDTH OF IMAGES;
height: auto;
}

Alternative code (Adjusts height of images):


img {
max-height: DESIRED HEIGHT OF IMAGES;
width: auto;
}

Leave a Reply