Naomi Posted February 27, 2016 Share Posted February 27, 2016 (edited) Hi all, I just finished a webdesign course for home study. Now I am working on my first assigment but it's going quite the way I want... I want to use a background image in my header div. Here is my code, what am I doing wrong? Can anybody help me please? Thank you! my CSS: #header { background-image: url(header.jpg); background-size: cover; background-position: fixed; text-align: center; width: 100%; height: 200px; top: 100px; } HTML <div id="header"> <header> <div class="nav"> <ul> <li><a href="">Home</a></li> <li><a href="">About</a></li> <li><a href="">Classes</a></li> <li><a href="">Contact</a></li> </ul> </div> </header> </div> Edited February 27, 2016 by Naomi Link to comment Share on other sites More sharing options...
COBOLdinosaur Posted February 27, 2016 Share Posted February 27, 2016 The first thing you need to do is make sure the image can actually be found by the CSS parser. The url you are using might need a path depending on the location of the image file in relationship to the location of the page file, and the css file. Link to comment Share on other sites More sharing options...
dsonesuk Posted February 27, 2016 Share Posted February 27, 2016 There is no such value of fixed for background-position: You maybe thinking of property background-attachment: The top: property only works if position: property is used with values relative, absolute or fixed. Link to comment Share on other sites More sharing options...
Naomi Posted March 11, 2016 Author Share Posted March 11, 2016 Thank you for your reply, I was busy with exams so I didn't find the time to look at your reaction. I checked the path so many times and tried everything and everytime thinking why it's not working now I look again and I see I did it wrong... Thank you! Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now