Forum Moderators: not2easy
If you render this code you'll see a 100% height white stripe flanked by two 100% height thinner black stripes. No big deal, just three divs. However, I need to center those divs. I've tried the seemingly obvious "container div" but I'm missing something...probably and hopefully something trivial.
Here's the code, and thank you for any insight:
<!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 {
height: 100%;
}
body {
margin: 0px;
padding: 0px;
background-color:#717171;
text-align: center;
}
div#contentContainer {
height: 100%;
text-align: center;
margin: 0 auto;
}
div#stripeLeft {
width: 10px;
background-color:#000;
float: left;
height: 100%;
}
div#mainContent {
width: 980px;
height: 100%;
margin: 0px auto;
background-color: #fff;
float: left;
}
div#stripeRight {
width: 10px;
background-color:#000;
float: left;
height: 100%;
}
</style>
</head>
<body>
<!-- Container DIV -->
<div id="contentContainer">
<!-- Left stripe DIV -->
<div id="stripeLeft"></div>
<!-- Main content DIV -->
<div id="mainContent"></div>
<!-- Right stripe DIV -->
<div id="stripeRight"></div>
</div>
</body>
</html>
and a warm welcome to these forums. ;)
As the widths of the #stripeLeft, #stripeRight and #mainContent divs total 1000px,
then this value must be set to the #contentContainer rule...
div#contentContainer {
width:1000px;
height: 100%;
text-align: center;
margin: 0 auto;
}
No problem, you're welcome. ;)