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

    Hi,

    We have a section where a background image is placed.
    We have set the image to stretch to full width.
    But we also need the section to be as heigh as the image (so the image is not cut off).

    With the settings we cannot achieve this, please advise how to achieve this.

    Love to hear from you!

    #459878

    Hey hotspot!

    Can you show us an example, so we can target the area?
    Your code needs to be something like

    div{
        background-image: url('5239fffd61ddf.jpg');
        background-size: contain;
        background-repeat: no-repeat;
        width: 100%;
        height: 0;
        padding-top: 66.64%; /* (img-height / img-width * width) */
                    /* (853 / 1280 * 100) */
    }

    Best regards,
    Basilis

    #459880
    This reply has been marked as private.
    #461058

    Hi!

    I see you’re using image elements + text blocks absolute positioned now, i guess that solves your initial issue?

    Cheers!
    Josue

    #461156

    Hi Josue,

    Because we could not find a solution (and could not wait for an answer anymore) we had to rebuild the section.
    But we would still like to solve it in the intial way.
    Do you know a solution for this issue?

    Love to hear from you.

    #461190

    It would be possible with some JavaScript to detect the height of the image and based on that adjust the section height when the window resizes, unfortunately that involves custom coding which is beyond our support scope. You can request a customisation quote from a third-party provider here.

    Regards,
    Josue

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