• hbee

    (@heatherbodlak)


    I would like to find a way to have the featured image that appears at the top of the Post content to always be the same size.

    I would like it to be full width but the height to be always cropped to 100px for example (so it isn’t as large as it seems to be by default). Where in the CSS can I edit this?
    Thank you

Viewing 6 replies - 1 through 6 (of 6 total)
  • Hi,

    what is you site link?

    Thread Starter hbee

    (@heatherbodlak)

    Hi! It’s still under construction…. don’t have it live yet. I can make it live so you can check it — let me know when you do so I can then put back in “under construction” mode! thanks!
    https://www.anpacpibembibre.com

    see “NOVAS” page — that is where I am unhappy with how the images are differnt sizes and way too big in some cases…

    This code will make the images proportionally smaller with a max height of 100px, but I don’t think it’s exactly what you want.

    a.feature-img.radius-top img {
        max-height: 100px;
        width: auto;
        margin-top: 30px;
    }

    Just add it to the bottom of your css file to ensure it gets read last and overrides any previous styles.

    Thread Starter hbee

    (@heatherbodlak)

    that’s a bit better, thanks! But not exactly what I am trying to achieve… Any ideas on how to force the featured image to be cropped so that it extends the full width?

    I guess in that CSS I could also set a specific width… but that would stretch it of course… Hmmm…

    I prefer to use the css property ‘background-image’ to have a little better control over stuff like that, but that would require rewriting some code in the template files…

    You can tell the parent container to be set to a certain height and hide anything larger than it, and then tell the image inside to stretch to the full width of that container whilst maintaining proportion.

    a.feature-img.radius-top {
        overflow: hidden;
        max-height: 120px; /* the height of the container */
    }
    a.feature-img.radius-top img {
        width: 100%;
        position: relative;
        top: -110px; /* this will change the images position within the container */
    }

    and don’t forget to delete that last portion of code you tried.

    Thread Starter hbee

    (@heatherbodlak)

    That is perfect!! Thank you so much.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Featured image size in posts’ is closed to new replies.