[Resolved] Add "object-fit" for featured images in custom css

Home Forums Support [Resolved] Add "object-fit" for featured images in custom css

Home Forums Support Add "object-fit" for featured images in custom css

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #676991
    Leon

    I’m using square featured images and want to use object-fit for them. How do I create that? In custom css?
    Thanks,
    Leon

    #677312
    Tom
    Lead Developer
    Lead Developer

    Hi there,

    What are you trying to achieve with object-fit? Any examples?

    #678967
    Leon

    As you can see on http://l-seven.nl/wordpress/?page_id=12455 I’ve made all featured images square.

    I want the images to fill the square and crop if necessary and read that object-fit cover should do exactly that:
    https://css-tricks.com/almanac/properties/o/object-fit/

    I tried to add that in custom css but it didn’t work. Hope you can help.
    Thanks,
    Leon

    #679037
    David
    Staff
    Customer Support

    Hi there,

    try this additional CSS:

    .post-image-aligned-center .post-image img {
      width: 110px;
      height: 110px;
      object-fit: cover;
    }
    #679039
    Leon

    That did it. Thank you very much for you fast reply.
    Leon

    #679044
    David
    Staff
    Customer Support

    You’re welcome. Glad we could help 🙂

Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.