Resizing Images with CSS

Marcus92
Curious newcomer Level 2
Posts
2
Like
0
Since
2018
Automatically translated from Spanish
Author #1

Hi!

sometimes on my blog I have problems with images, they go over the maximum width that the content has, could anyone help me to resize images with CSS?

I know I can adjust in wordpress so that they resize themselves, but I want them in good quality so that people can download them if they want to.

Automatically translated from Spanish

1 replies

  1. Julio Rodríguez
    • SEO & GEO
    • CMS & No-code
    • Hosting & Servers
    • Web Development
    • Off-topic
    Regular Level 8
    Posts
    93
    Like
    0
    Since
    2026
    Automatically translated from Spanish

    The ideal thing would be to show a thumbnail and link the image to a full-size one, but what you want would be something like this.

    We have a container div and inside it an image

    <div class="content"><img src="#"></div>

    It's assumed that the content has a width that's either fixed (px) or dynamic (%)

    so we'd have to put something like this.

    div.content { width: 600px; margin: 0 auto 0 auto; padding: 5px; background-color: #000000; color: #fff; } div.content img { max-width: 100%; }

    I really recommend you set the max width to 99% or 98% so there's a small gap, and if so, center them with margin: 0 auto;

    Automatically translated from Spanish

Sign in to take part in the forum.

This reply will be hidden. It is kept and can be restored.

Reason
or with your email