Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #1475392

    How do I make the background image on a color section responsive?

    #1475403

    Hey tsays,

    Thank you for the inquiry.

    The background images applied to the color sections should be responsive by default. Just make sure that Styling > Background Image > Background Repeat is set to Stretch to Fit.

    Best regards,
    Ismael

    #1475435

    Hi Ismael. Yes, that setting is correct, but it is not responsive:

    #1475448

    you had to know the aspect ratio of your bg-image. then you can calculate the height of that section in relation to 100vw of width.
    f.e. if your bg-image is a 16/9 image – then the height should be 56.25vw. So you can force the height to be of that height of the image.

    This will work if your content does not grow over that height.
    See an example here: https://webers-testseite.de/colorsection-responsive/

    #1475449

    @guenni007, thank you. Sorry, what is vw? And so what you’re saying is the header image needs to be modified in order to be responsive? Or do you have a recommended size that I should make the header image so that it is automatically responsive?

    #1475454

    you are talking about a color-section – and its background image – right? i can not see the header image in your question.

    vw is another relative length value. https://css-tricks.com/the-lengths-of-css/#aa-vw
    1vw is equal to 1% of the width of the viewport ( viewport width = vw)
    so if you like to have the background-image to have full width – you can set the bg-image to cover the container – so it has a width of 100vw.
    Now if you got a background-image that has a 16:9 aspect ratio then. 16 = 100vw and 9 = x vw ?
    Simple rule of three the height of the container had to be 56.25vw.

    you see my example page that this is a responsive color-section. The only problem is that now the height of the container no longer grows with its content. But if you only got a heading f.e. with fluid font-size – this will work in that manner.

    #1475464

    Hi,

    Thank you for the update.

    You may need to replace the Color Section with an actual Image or a Fullwidth Easy Slider element to make sure that the container resizes based on the size of the image, rather than the other way around. If you choose to use the Image element, you can adjust the container’s maximum width using css. Please refer to this documentation: https://kriesi.at/documentation/enfold/color-section/#color-section-with-100-content-width

    Thanks @Guenni007.

    Best regards,
    Ismael

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