mtdon1
11-01-2010, 02:38 AM
Hi all,
I am very new to the web coding scene and am having a bit of trouble with my containers and positioning to have the site function as I would like.
I have the core background images spanning the length of the browser as I would like. However I would like my content to be centered on the page with the effect of when the browser window becomes too small the content is "fixed" and the shrinking window stops "swallowing" the content.
In essence I want my site to function like this: http://store.steampowered.com/
Notice that when you shrink the browser beyond the centered content, the content becomes "fixed" at the left hand side. I imagine I need another container somewhere, but after doing research, I am a bit lost.
Here is my code thus far:
body {
margin: 0;
background-color:#FFF
}
#container {
width: 100%;
margin-top: 0px;
margin-right: 0px;
margin-bottom: 0px;
margin-left: 0px;
padding-top: 0px;
padding-right: 0px;
padding-bottom: 0px;
padding-left: 0px;
height: auto;
}
.top_nav {
background-image: url(../images/top_nav.jpg);
background-repeat: repeat-x;
margin: 0px;
padding: 0px;
height: 43px;
width: 100%;
clear: left;
}
.body_bg {
background-image: url(../images/body_bg.jpg);
background-repeat: repeat-x;
margin: 0px;
padding: 0px;
float: left;
height: auto;
width: 100%;
}.title_bg {
height: 179px;
background-color: #FFF;
background-image: url(../images/title_bg.jpg);
background-repeat: no-repeat;
background-position: center;
}
.nav_bg {
background-image: url(../images/nav_bg.jpg);
background-repeat: repeat-x;
height: 41px;
width: 100%;
}
HTML:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.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>
<link href="css/main.css" rel="stylesheet" type="text/css" />
<link href="css/top_nav.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="container">
<div class="top_nav"></div>
<div class="title_bg"></div>
<div class="nav_bg"></div>
<div class="body_bg"></div>
</div>
</body>
</html>
Thank you for your time!
-Mike
I am very new to the web coding scene and am having a bit of trouble with my containers and positioning to have the site function as I would like.
I have the core background images spanning the length of the browser as I would like. However I would like my content to be centered on the page with the effect of when the browser window becomes too small the content is "fixed" and the shrinking window stops "swallowing" the content.
In essence I want my site to function like this: http://store.steampowered.com/
Notice that when you shrink the browser beyond the centered content, the content becomes "fixed" at the left hand side. I imagine I need another container somewhere, but after doing research, I am a bit lost.
Here is my code thus far:
body {
margin: 0;
background-color:#FFF
}
#container {
width: 100%;
margin-top: 0px;
margin-right: 0px;
margin-bottom: 0px;
margin-left: 0px;
padding-top: 0px;
padding-right: 0px;
padding-bottom: 0px;
padding-left: 0px;
height: auto;
}
.top_nav {
background-image: url(../images/top_nav.jpg);
background-repeat: repeat-x;
margin: 0px;
padding: 0px;
height: 43px;
width: 100%;
clear: left;
}
.body_bg {
background-image: url(../images/body_bg.jpg);
background-repeat: repeat-x;
margin: 0px;
padding: 0px;
float: left;
height: auto;
width: 100%;
}.title_bg {
height: 179px;
background-color: #FFF;
background-image: url(../images/title_bg.jpg);
background-repeat: no-repeat;
background-position: center;
}
.nav_bg {
background-image: url(../images/nav_bg.jpg);
background-repeat: repeat-x;
height: 41px;
width: 100%;
}
HTML:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.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>
<link href="css/main.css" rel="stylesheet" type="text/css" />
<link href="css/top_nav.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="container">
<div class="top_nav"></div>
<div class="title_bg"></div>
<div class="nav_bg"></div>
<div class="body_bg"></div>
</div>
</body>
</html>
Thank you for your time!
-Mike