...

View Full Version : Background issue



Bee_01
01-05-2010, 05:55 PM
Ok,

I have a header with a grey background that needs to fit full width across the page and then a background on the body which will grow/shrink with the content. My question is, how do a make the header div 100% without it producing a horizontal scrollbar? I know you can hide scroll bars but just hiding the horizontal scroll doesn't work in all browsers, I need something that will work in ie8, ff, ie7, google and ie6 if poss. I don't mind doing a few hacks along the way but would rather it was clean.

Really need your help as I can't present this design until I am confident that I can build it.

Cheers,

Bee
x:confused:

Excavator
01-05-2010, 06:04 PM
Hello Bee_01,
This has no scrollbar caused by #header. It does need one when you get narrower thant the width of #container.


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<style type="text/css">
html, body {
font: 100% "Comic Sans MS";
background: #FC6;
}
* {
margin: 0;
padding: 0;
border: 0;
}
#header {
height: 50px;
background: #ccc;
text-align: center;
}
#container {
height: 550px;
width: 800px;
margin: 0 auto;
background: #999;
overflow: auto;
font-size: 0.8em;
}
</style>
</head>
<body>
<div id="header">
<h1>This is my Header</h1>
<!--end header--></div>
<div id="container">
<!--end container--></div>
</body>
</html>

Does that help at all?

Bee_01
01-05-2010, 07:11 PM
Yes! I can't believe I couldn't see that, duh! lol, I've just done this to test it:


<body style="text-align: center; margin: 0px; padding: 0px;">
<div style="background-color: yellow; height: 100px;"></div>
<div style="width: 900px; background-color: pink; margin: auto; height: 100px;"></div>
</body>


lol! it's amazing how things get complicated when the simple answers are missed :D

Thanks

Bee
x

CoffeeCup.com
01-07-2010, 03:38 PM
Hello,

Please visit the following sites to see if they can help you out:

http://www.htmlcodetutorial.com/document/_BODY_BACKGROUND.html
http://www.webmonkey.com/reference/HTML_Cheatsheet
http://w3schools.com/

Hope this helps!!!
CoffeeCup.com :thumbsup:



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum