Adjusting Twenty Eleven Header Image
-
I have the CSS upgrade and have inserted a header image using this code:
#branding {
background: url(‘https://themabelkwong.files.wordpress.com/2015/04/mabelkwong_final15.png?w=900’) no-repeat scroll 0 0 transparent;
height: 500px;
}However, my header doesn’t seem to be in the middle and I want it centralised. I tried inserting this code with the word “center” but then the header disappears:
#branding {
background: url(‘https://themabelkwong.files.wordpress.com/2015/04/mabelkwong_final15.png?w=900’) center no-repeat scroll 0 0 transparent;
height: 500px;
}How can I make my header centralised?
Aside from that, my header doesn’t seem to be that responsive when I shrink my screen. See this image that I took a screenshot off:
As you can see, the header gets cut off to the right the more I shrink the screen.
Any help will be appreciated. Thank you!
The blog I need help with is: (visible only to logged in users)
-
-
-
This is a hard thing to do when inserting an image into the CSS. We can set a background size declaration to resize the image, but then on smaller screens you end up with a large gap between the image and the menu. You can add the following to your #branding rule to see what I mean.
background-size: contain;
To adjust positions so that a large gap doesn’t occur between the image and menu, and between the menu and content, we would need the following Media Queries.@media screen and (max-width: 850px) { #access { margin-top: 500px; } } @media screen and (max-width: 800px) { #access { margin-top: 450px; } } @media screen and (max-width: 750px) { #branding { height: 400px; } } @media screen and (max-width: 650px) { #branding { height: 300px; } #access { margin-top: 300px; } } @media screen and (max-width: 550px) { #access { margin-top: 250px; } #branding { height: 250px; } } @media screen and (max-width: 450px) { #access { margin-top: 200px; } #branding { height: 200px; } } @media screen and (max-width: 380px) { #access { margin-top: 200px; } #branding { height: 150px; } } -
Thanks for that. I added that to my CSS:
#branding {
border-top: none;
padding-bottom: 10px;
position: relative;
z-index: 9999;
background-size: contain;
}Then I added the media queries as you’ve specified. However, the header image still isn’t resizing itself. Is there a workaround or is it just me? (I’ve taken out the code I inserted).
Thank you.
-
- The topic ‘Adjusting Twenty Eleven Header Image’ is closed to new replies.

