• Resolved JackGraal

    (@jackgraal)


    Hi,

    I don’t know why, but all post images have margin added on both sides and are set to 720px width. I’ve tried to find the cause in CSS and theme files, but with no success. I changed img width style for large and full size images, but it backfired in some parts of the website.

    How can I make all post images 100% width?

    Here’s an example post from my blog: https://jackgraal.com/pl/valiant-hearts-the-great-war-recenzja/

Viewing 8 replies - 1 through 8 (of 8 total)
  • Hi Jack. Have you tried this?

    img.aligncenter {
      width: 100%
    }
    Thread Starter JackGraal

    (@jackgraal)

    Yes, that’s the code I’ve tried but it backfired with some smaller images being resized to 100% width of the page.

    Thread Starter JackGraal

    (@jackgraal)

    Is there a way to fix this? I can’t seem to find anything in CSS that sets smaller width for images or some margin/padding.

    Jack – Are you talking about the large images on your post that appear to be narrower than the text area? You mentioned setting images to 100% width backfired. Maybe there’s a way to identify those images and reset them to a smaller size?

    Thread Starter JackGraal

    (@jackgraal)

    I have no idea what causes this. I’ve tried to find something via Chrome Developer Tools and it seems that the width is always set to 720 px. I don’t know why.

    The larger images are using “thumb-large” which is a theme-generated thumbnail 720×340. Since the margins are set to “0 auto” it must just fill out the margins to the width of the container which, in this case, appears to be around 780px. What if we target them with something like this:

    .single-post article img.aligncenter {
      width: 100%
    }

    Does that still affect the other smaller images?

    wmaxson5

    (@wmaxson5)

    I am having a similar issue with some of my images, too.
    I am trying to code in an image to display 100% width and a certain height, both of which are ignored when I try it in the css and plain html code.
    This what I initially wrote, but is not working:
    (in the html file)
    <div id=”pagetwowood” >
    <img src=”https://eurobakery.helixhouse.co/wp-content/uploads/sites/34/2013/04/woodGrain.png&#8221; alt=”wood” border=”0″ />
    </div>
    (in the CSS file)
    #pagetwowood {
    width: 100%;
    }
    and I also tried it as a class, too.

    Thread Starter JackGraal

    (@jackgraal)

    I’ve made it work.

    Go to functions.php and find “add_image_size”.

    All you have to do is to change dimensions in these lines of the code:

    // Thumbnail sizes
    add_image_size( 'thumb-small', 160, 160, true );
    add_image_size( 'thumb-medium', 520, 245, true );
    add_image_size( 'thumb-large', 720, 340, true );

    I changed it to:

    // Thumbnail sizes
    add_image_size( 'thumb-small', 160, 160, true );
    add_image_size( 'thumb-medium', 520, 245, true );
    add_image_size( 'thumb-large', 780, 368, true );

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Large images in posts are not 100% width’ is closed to new replies.