WordPress.org

Ready to get started?Download WordPress

Forums

max width of posts (4 posts)

  1. mmusil
    Member
    Posted 5 years ago #

    I added an image to my blog that is larger than my post area, i.e. it overlaps into the sidebars. Obviously I would prefer that it doesn't. I know I can use the <img> tag to shrink it (<img="myphoto.jpg" width="20" height="20"). However, in this case I would prefer to shrink the image without using the <img> tag. I think that means I have to play with the site's code somehow, but I'm not sure.

    So I guess my question is, is it possible to set the maximum width of your posts? Or is there another/easier way to do this?

  2. stvwlf
    Member
    Posted 5 years ago #

    your theme can be set up to limit the width of the post

    what makes more sense however is for you to reduce the size of the image using image software. if it fit the available space you had, your problem would be resolved

    check out XnView and FastStone as free ones, for starters

    If you have no experience with this, try using http://picnik.com

  3. mmusil
    Member
    Posted 5 years ago #

    In this case I would rather not reduce the size of the image through an offline program.

    Besides that, though, I would like to learn how to reduce the image through the code and without attributing the <img> tag. I'm always trying to learn more about working with wordpress. Would this be a property/value in the style sheet, and if so, which one?

  4. stvwlf
    Member
    Posted 5 years ago #

    Although it can be done, its not a good practice to take an image that is, say, 900 x 200, and have the browser display it as 800 x 175. Its much better to use an image software to resize the image to the exact size that you need. For one thing, it will be smaller in file size, resulting in slightly faster download speed.

    If you want to display it smaller, you can set a height and width attribute in the <img> tag in header.php. However many WordPress header images are displayed as CSS background images, set in the stylesheet, and are not declared in the HTML code. Its not possible to display a background image any smaller than its actual size. If the area it is displayed in is smaller than the image size, only a portion of the image is displayed. It is designed to work that way. look in your stylesheet for a "background:" setting, followed by url({filename}.{jpg, gif, etc})

Topic Closed

This topic has been closed to new replies.

About this Topic