pinkshiro
08-16-2005, 03:19 AM
Hey there,
Is it at all possible to get consistant, cross-browser page margins?? :confused: This seems like quite a common problem, but I can't seem to get a 10px top and bottom page margin in WIN IE, netscape, opera and firefox.
I'll introduce my html, body & div#container css first:
html {
height: 100%;
width: 100%;
margin: 0px 0px 0px 0px;
padding: 0px 0px 0px 0px;
}
body {
margin: 0px 0px 0px 0px;
padding: 0px 0px 0px 0px;
height: 100%;
width: 100%;
background-color: #AAAAAA;
text-align: center;
}
div#container {
margin-left: auto;
margin-right: auto;
width: 757px;
height: 100%;
text-align: left;
padding: 0px 0px 0px 0px;
}
As you can see, html & body have both their margins and padding set to zero, which totally removes all all margins top and bottom, correct? div#container is for centering the content on my page.
Now here's my html, followed by the rest of my css:
<!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>
<title>.: OpsCentre :.</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link href="css/testcss.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="container">
<div class="topbar"></div>
<div id="banner"></div>
<div class="topbar1"><span class="topbar">The Home of Software Solutions for the Passenger Transport Industry</span></div>
<div id="bodybg">
<div class="hundred">
<!--<ul>
<li class="nogap"><a href="#">Home</a></li>
<li><a href="#">Products</a></li>
<li><a href="#">Packages</a></li>
</ul>-->
</div>
</div>
<div class="botbar">
<div class="floatleft"><a class="bottom" href="contact.html?name=4">Click here to contact the webmaster</a></div>
<div class="floatright"><span class="topbar">Copyright © 2005, Transport Management Systems Ltd. (NZ)</span></div>
</div>
</div>
</body>
</html>
div.topbar {
margin-top: 10px;
margin-bottom: 0px;
vertical-align: top;
line-height: 17px;
background-image: url(../images/topbar_bg.jpg);
height: 17px;
width: 755px;
font-family: arial, helvetica, sans-serif;
font-size: 10px;
color: #FFFFFF;
text-align: right;
text-indent: 10px;
border-style: solid;
border-color: #000000;
border-top-width: 1px;
border-right-width: 1px;
border-bottom-width: 1px;
border-left-width: 1px;
}
div.topbar1 {
margin-top: 0px;
margin-bottom: 0px;
vertical-align: top;
line-height: 17px;
background-image: url(../images/topbar_bg.jpg);
height: 17px;
width: 755px;
font-family: arial, helvetica, sans-serif;
font-size: 10px;
color: #FFFFFF;
text-align: right;
text-indent: 10px;
border-style: solid;
border-color: #000000;
border-top-width: 1px;
border-right-width: 1px;
border-bottom-width: 1px;
border-left-width: 1px;
}
div.botbar {
margin-bottom: 0px;
vertical-align: top;
line-height: 17px;
background-image: url(../images/topbar_bg.jpg);
height: 17px;
width: 755px;
font-family: arial, helvetica, sans-serif;
font-size: 10px;
color: #FFFFFF;
text-align: left;
text-indent: 5px;
border-style: solid;
border-color: #000000;
border-top-width: 1px;
border-right-width: 1px;
border-bottom-width: 1px;
border-left-width: 1px
}
div#banner {
vertical-align: top;
background-image: url(../images/index_04.jpg);
background-repeat: no-repeat;
height: 102px;
width: 755px;
border-style: solid;
border-color: #000000;
border-top-width: 0px;
border-right-width: 1px;
border-bottom-width: 0px;
border-left-width: 1px;
}
div#bodybg {
vertical-align: top;
background-color: #ffffff;
height: 100%;
width: 755px;
margin: 0px 0px 0px 0px;
padding: 10px 0px 10px 0px;
border-style: solid;
border-color: #000000;
border-top-width: 0px;
border-right-width: 1px;
border-bottom-width: 0px;
border-left-width: 1px;
}
div.hundred {
height: 100%;
width: 150px;
background-color: #cccccc;
margin: 0px 10px 0px 10px;
padding: 0px 0px 0px 0px;
}
From the html above, you can see that the first thing sitting inside the container tag is <div class="topbar">, which I have set to have a margin-top="10px"....that seems to take care of the top 10px margin that I want. But nothing I do can consistently make a 10px bottom margin. Here's what I have tried so far:
Adding 'margin-bottom: 10px' to div.botbar (the last div within #container). This working in WINIE, but not netscape, firefox or opera.
Changing the CSS of html: 'margin: 0px 0px 0px 0px;' to 'margin: 0px 0px 10px 0px'. This worked in everything except Opera. I have alternated between 'margin' and 'padding', even trying to set both to '0px 0px 10px 0px' at the same time, but it still wont affect the bottom margin in opera (v. 8.0).
All I want is a nice cross-platform top and bottom 10px margin :(
Is it at all possible to get consistant, cross-browser page margins?? :confused: This seems like quite a common problem, but I can't seem to get a 10px top and bottom page margin in WIN IE, netscape, opera and firefox.
I'll introduce my html, body & div#container css first:
html {
height: 100%;
width: 100%;
margin: 0px 0px 0px 0px;
padding: 0px 0px 0px 0px;
}
body {
margin: 0px 0px 0px 0px;
padding: 0px 0px 0px 0px;
height: 100%;
width: 100%;
background-color: #AAAAAA;
text-align: center;
}
div#container {
margin-left: auto;
margin-right: auto;
width: 757px;
height: 100%;
text-align: left;
padding: 0px 0px 0px 0px;
}
As you can see, html & body have both their margins and padding set to zero, which totally removes all all margins top and bottom, correct? div#container is for centering the content on my page.
Now here's my html, followed by the rest of my css:
<!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>
<title>.: OpsCentre :.</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link href="css/testcss.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="container">
<div class="topbar"></div>
<div id="banner"></div>
<div class="topbar1"><span class="topbar">The Home of Software Solutions for the Passenger Transport Industry</span></div>
<div id="bodybg">
<div class="hundred">
<!--<ul>
<li class="nogap"><a href="#">Home</a></li>
<li><a href="#">Products</a></li>
<li><a href="#">Packages</a></li>
</ul>-->
</div>
</div>
<div class="botbar">
<div class="floatleft"><a class="bottom" href="contact.html?name=4">Click here to contact the webmaster</a></div>
<div class="floatright"><span class="topbar">Copyright © 2005, Transport Management Systems Ltd. (NZ)</span></div>
</div>
</div>
</body>
</html>
div.topbar {
margin-top: 10px;
margin-bottom: 0px;
vertical-align: top;
line-height: 17px;
background-image: url(../images/topbar_bg.jpg);
height: 17px;
width: 755px;
font-family: arial, helvetica, sans-serif;
font-size: 10px;
color: #FFFFFF;
text-align: right;
text-indent: 10px;
border-style: solid;
border-color: #000000;
border-top-width: 1px;
border-right-width: 1px;
border-bottom-width: 1px;
border-left-width: 1px;
}
div.topbar1 {
margin-top: 0px;
margin-bottom: 0px;
vertical-align: top;
line-height: 17px;
background-image: url(../images/topbar_bg.jpg);
height: 17px;
width: 755px;
font-family: arial, helvetica, sans-serif;
font-size: 10px;
color: #FFFFFF;
text-align: right;
text-indent: 10px;
border-style: solid;
border-color: #000000;
border-top-width: 1px;
border-right-width: 1px;
border-bottom-width: 1px;
border-left-width: 1px;
}
div.botbar {
margin-bottom: 0px;
vertical-align: top;
line-height: 17px;
background-image: url(../images/topbar_bg.jpg);
height: 17px;
width: 755px;
font-family: arial, helvetica, sans-serif;
font-size: 10px;
color: #FFFFFF;
text-align: left;
text-indent: 5px;
border-style: solid;
border-color: #000000;
border-top-width: 1px;
border-right-width: 1px;
border-bottom-width: 1px;
border-left-width: 1px
}
div#banner {
vertical-align: top;
background-image: url(../images/index_04.jpg);
background-repeat: no-repeat;
height: 102px;
width: 755px;
border-style: solid;
border-color: #000000;
border-top-width: 0px;
border-right-width: 1px;
border-bottom-width: 0px;
border-left-width: 1px;
}
div#bodybg {
vertical-align: top;
background-color: #ffffff;
height: 100%;
width: 755px;
margin: 0px 0px 0px 0px;
padding: 10px 0px 10px 0px;
border-style: solid;
border-color: #000000;
border-top-width: 0px;
border-right-width: 1px;
border-bottom-width: 0px;
border-left-width: 1px;
}
div.hundred {
height: 100%;
width: 150px;
background-color: #cccccc;
margin: 0px 10px 0px 10px;
padding: 0px 0px 0px 0px;
}
From the html above, you can see that the first thing sitting inside the container tag is <div class="topbar">, which I have set to have a margin-top="10px"....that seems to take care of the top 10px margin that I want. But nothing I do can consistently make a 10px bottom margin. Here's what I have tried so far:
Adding 'margin-bottom: 10px' to div.botbar (the last div within #container). This working in WINIE, but not netscape, firefox or opera.
Changing the CSS of html: 'margin: 0px 0px 0px 0px;' to 'margin: 0px 0px 10px 0px'. This worked in everything except Opera. I have alternated between 'margin' and 'padding', even trying to set both to '0px 0px 10px 0px' at the same time, but it still wont affect the bottom margin in opera (v. 8.0).
All I want is a nice cross-platform top and bottom 10px margin :(