3kaj Posted August 18, 2012 Share Posted August 18, 2012 Hi. I'm setting up a layout for my website but I'm having trouble adding a background image. I had one before, but I changed around the layout and I don't remember what I changed anymore. It must be a dumb little mistake - just can't find it. Any help is much appreciated. HTML: <html><head><title>website.com</title><link href="style.css" rel="stylesheet" type="text/css"></head><body leftmargin="0px" topmargin="0px" marginwidth="0px" marginheight="0px"><center> <div id="container"> <div id="middlenav"></div> <div id="rightnav"></div> <div id="leftnav"></div> <div id="content"></div> <div id="footer"><font size="4">website.com</font></div> </div> </center></body></html> CSS: #container {background-image: url(bg.png);} #rightnav { float: right;width: 300px;height: 678px;border-left: 1px solid; } #leftnav { float: left;width: 300px;height: 678px;border-right: 1px solid; } #middlenav { } #content { } #footer {position:fixed;bottom:0px;left:0px;width:1280px;border-top: 1px solid;background-color: #D1C0A7; } Link to comment Share on other sites More sharing options...
shaijuelayidath Posted August 18, 2012 Share Posted August 18, 2012 (edited) First you make a folder named 'images'then you put your 'bg.png. in itthen try this code#container {background-image: url(images/bg.png);width: 100%;float: left;} Edited August 18, 2012 by shaijuelayidath Link to comment Share on other sites More sharing options...
dsonesuk Posted August 18, 2012 Share Posted August 18, 2012 The container element does not see the floated elements inside it, because the footer uses position: fixed; is is totally taken out of the flow of html elements and not seen either, plus with no content in content element, the container element height will be a big fat 0. give the container element overflow:hidden; this will at least make the floated elements visible to it. 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