Sub-header Background Image


I am trying to adjust the sub-header background image, so that it "covers" the sub-header frame (for an example of what I am looking for, see http://www.shainblumphoto.com/project/iceland-photography/).  I tried adding the code below to the "Custom CSS" field, but the sub-header image appears to "cover" the entire browser window, not just the sub-header frame.  As a result, the image bounces around the sub-header frame depending on the size of the browser window.  How can I make the subheader background image cover the subheader frame AND "center center" it?  Any help here would be greatly appreciated.

/* Subheader */
#Subheader {
    padding: 310px 0 230px;
    background-position: center center;
    background-size: cover;
    top:0px;
    left:0px
}

Comments

  • Hi,

    if you look for example at http://themes.muffingroup.com/be/eco/programs/ you see that we have similar header/subheader on many demos. So what we suggest is to create extra WP instance where you can import demos and learn how some things were made. You can also send us link to page where you got it so we can have a look on it.

    Thanks!
  • Thanks.  I've imported many of the demos, but none of them, including the "Eco" demo, has the same background properties as the link above.  Specifically, the "Eco" demo does not re-size the background image to fit the size of the header.  To address this, I added the following code to the "Custom CSS" field:

    #Header_wrapper {
        background-size: cover;
        background-position: center center;
    }

    #Subheader {
        padding: 300px 0 150px;
    }

    @media only screen and (max-width: 767px) {
    #Subheader { padding: 150px 0 75px;}
    }

    While this re-sizes the header image, there are still two problems: (1) the background image isn't centered (center center) within the header, and (2) the size of the header image bounces around --both horizontally and vertically -- based on the size of the browser window (as you'll notice in the example above, the image only re-sizes when you change the width, not height, of the browser window.  Please advise on how to solve this problem.
  • What's the link of page where you got above problems then? Because so far you didn't posted it yet.
Sign In or Register to comment.
This website uses cookies

We use cookies to personalise content and ads, to provide social media features and to analyse our traffic. We also share information about your use of our site with our social media, advertising and analytics partners who may combine it with other information that you’ve provided to them or that they’ve collected from your use of their services.

Cookies are small text files that can be used by websites to make a user's experience more efficient.

The law states that we can store cookies on your device if they are strictly necessary for the operation of this site. For all other types of cookies we need your permission. This means that cookies which are categorized as necessary, are processed based on GDPR Art. 6 (1) (f). All other cookies, meaning those from the categories preferences and marketing, are processed based on GDPR Art. 6 (1) (a) GDPR.

This site uses different types of cookies. Some cookies are placed by third party services that appear on our pages.

You can at any time change or withdraw your consent from the Cookie Declaration on our website.

Learn more about who we are, how you can contact us and how we process personal data in our Privacy Policy.

Please state your consent ID and date when you contact us regarding your consent.