• Resolved jimithing007

    (@jimithing007)


    Is there a way to change the padding of an element dependent on the screen resolution? The problem that I’m having is with the elements directly beneath my hero image. The spacing looks fine on my computer, but on certain high resolution displays, the images rise up into the hero image.

    I took a screenshot here

    I am using the Beaver Builder. If I adjust the padding so that it looks appropriate on the high-res screen, it gets spaced too far out for the other displays. Is there some CSS code that could help with this?

Viewing 4 replies - 1 through 4 (of 4 total)
  • Hi @jimithing007,

    You’ll want to use breakpoints to define in between which resolutions you want to adjust the CSS for the element.

    Take a look at the following article, which should help explain things a bit better: https://www.w3schools.com/css/css_rwd_mediaqueries.asp

    The media queries are defined by you, so depending on what screen sizes you want to target your breakpoints may differ than those in the article.

    Thread Starter jimithing007

    (@jimithing007)

    Thanks Evan. That article was very helpful.

    Using the below (sorry that my coding is a bit amateur) seemed to work, at least from what I was able to check on my laptop.

    @media only screen and (min-width: 1423px) {
    #luminaires div {margin-top: -50px
    }
    @media only screen and (min-width: 1440px) {
    #luminaires div {margin-top: -50px
    }
    }
    @media only screen and (min-width: 1600px) {
    #luminaires div {margin-top: -30px
    }
    }
    @media only screen and (min-width: 1680px) {
    #luminaires div {margin-top: -30px
    }
    }
    @media only screen and (min-width: 1829px) {
    #luminaires div {margin-top: -10px
    }
    }
    @media only screen and (min-width: 1920px) {
    #luminaires div {margin-top: -10px
    }
    }
    @media only screen and (min-width: 2134px) {
    #luminaires div {margin-top: 10px
    }
    }
    @media only screen and (min-width: 2560px) {
    #luminaires div {margin-top: 10px
    }
    }
    }

    In a similar vein, is there a way to change how the hero image scales by screen resolution? With higher resolutions, the hero gets narrower and the text gets covered. Is there a way to keep it’s current scale (if you’re viewing at 1600×900)? If you want me to start a new topic for this I can.

    You’ll want to add the appropriate CSS declaration in the media query where you want to tweak the image size. You just have to add the declaration in the appropriate block in the code you have referenced above.

    Evan

    Thread Starter jimithing007

    (@jimithing007)

    I’ve researched but I can’t seem to find the right command that identifies the hero image – either that, or I can’t get the code right to make it work. I’ve tried a few different things but nothing seems to work. I started with this:
    @media only screen and (min-width: 3200px) .hero div {height: 200px; }

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Margin/padding below hero image’ is closed to new replies.