Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

HTML5 header element not displaying background image

I am working on a new HTML5 template. I am using the <header></header> element on the page with a simple logo background image.

header{ width:100%; height:100px; background:url(/dev-acn/img/header-logo-bg.jpg) 45px center no-repeat; }

Dev page: http://www.bcidaho.com/dev-acn/index.asp

I can see the background Image in PC Chrome, PC FF4, and on MAC FF5, however it does not display in IE6, IE7, or IE8...and when I open the developer tools in IE8 from some reason there is no opening <header> element tag in the code inspector just the </header> closing tag.

Does IE not recognize the <header> element, even if i have properties defined in the style.css? (located: http://www.bcidaho.com/dev-acn/css/style.css )

like image 693
tony noriega Avatar asked Jun 28 '11 20:06

tony noriega


People also ask

Why am I not getting a background image in HTML?

Make sure the image path is set correctly in the background-image url. Once you have made sure that your CSS file is linked correctly, also check that the image itself is set correctly. Again, you will want to open your code inspector in the browser to check.

How can I set background image in header tag in HTML?

The background-image property adds images as a background to a HTML element. You can add a background image to an element using the following syntax: background-image: url(imageUrl); imageUrl refers to the location of the image you wish to display.

Why is my div background image not showing?

you have to change your path background-image: url('/ximages/websiteheader1. png') ; TO background-image: url('ximages/websiteheader1. png') ; actually, remove the first / from the path of the image.

How do I put a background on my header?

You can set or change the background color and image of the page header with Zakra. Follow the steps as mentioned below: From your WordPress Dashboard, go to the Appearance > Customize > Content >Page Header section. Under the Background options, choose the Background Color or Background Image for the page header.


1 Answers

You need to include the html5shiv, which turns the new semantic HTML5 elements into block-level elements so IE can style them. It's a simple hack, so check the source to see exactly what it's doing.

like image 148
Stefan Kendall Avatar answered Sep 30 '22 19:09

Stefan Kendall