January 20, 201214 yr I have a page with a wrapper so that I can centre the main content etc. I wanted to have a background image to cover the area outside of the wrapper which works fine, but it will not tile. I have tried all the variations. This is my CSS: body { background-color:#FFF; font-family:Arial, Helvetica, sans-serif; background-image: url(../images/Background.jpg); background-repeat:repeat; } Is my CSS incorrect? If not, is there any other area of html or css which could be having an impact? Edited January 20, 201214 yr by Renaissance-Design Please use the code button or tags to format your code.
January 20, 201214 yr Short answer: yup. For example, if all the content is floated but not cleared, the body may not be long enough for the image to repeat.
January 20, 201214 yr Author Short answer: yup. For example, if all the content is floated but not cleared, the body may not be long enough for the image to repeat. Thanks for getting back to me and for putting my code into a box - forgot to do that, sorry. I don't understand what you mean re content etc. This is the CSS for my container (I hope I've done it correctly this time): #outer { width:840px; margin:0 auto; background-color:#FFF; } #wrapper { width:800px; margin:0 auto; background-color:#FFF; } #logo { margin:15px 0; float:left; } #group-title { margin:20px 0 15px 5px; float:left; } #topnav { clear:both; } #main-image { margin: 30px 0 0 0; padding: 10px 0 0 0; } #content { width:500px; float:left; } #news { width:259px; float:right; } #footer { clear:both; border-top:1px #ccc solid; padding:10px 0 3px 0; } /* Miscellaneous */ .footer-text { font-size:12px; text-align:center; }
January 20, 201214 yr Try: body { border: 1px solid red; } to see what the calculated height for your body element is. Floated elements have zero height in the document flow and containers take their height from their content, so if a container only contains floats its height will be zero. If it contains floats and non-floated elements, its height will be equal to the non-floated content. See this JSFiddle. Edited January 20, 201214 yr by Renaissance-Design
January 20, 201214 yr Author Thanks again. I added the border css and my page displays with a red box surrounding it, which spans the height of my page and the width of my screen into the background area. I've read the jsfiddle link, but am a little uncertain as to what I need to do to rectify the problem.
February 14, 201214 yr Author D'you have it online somewhere I could take a look at it? Hi, I've decided against having a background image, but am still having one or two problems with the display in IE6 and 7 which some of the potential users may have. The main image should only be a couple of mm below the menu bar, but drops by about 1/2" in IE 6/7. Not sure if it's linked to the float problem. I've loaded the test site here: www.gomeril.co.uk. I'd appreciate your comments. Thanks. Edited February 14, 201214 yr by LuluG
February 14, 201214 yr Author Is it dropping by the total height of your dropdown menus? Quite possibly, but not sure.
February 14, 201214 yr Author Is it dropping by the total height of your dropdown menus? I've just checked it in IE7 and the drop quite possibly equates to the height of the top level menu's. It's a spry menu bar, not sure if that helps (or hinders!)? OK, progress of sorts! I went back to your link (jsFiddle) and read through it again and suddenly it all made sense! There was just a flat line across the top of the menu bar. I added your cleared statement to index.html and my templates and have a box around the spry menu. I removed a margin I had previously set to force the image away from the menu. However, the cleared statement makes no difference to my Contact page. Would you be able to have a look at it for me to see what is happening? Edited February 14, 201214 yr by LuluG
Create an account or sign in to comment