Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Dreamweaver (CS5) site not centered anymore.

Status
Not open for further replies.

petrecca

MIS
Mar 9, 2011
1
US
Hi all,

I built a fairly basic site in Dreamweaver and set my left and right margins to auto, which centered the site. Great. When I went back to my template and made some revisions, I must have done something to override the margin settings. Now my entire site is justified left and I cannot, for the life of me, figure out why. I assume it's a problem with the template code, since all of my pages are now justified left. I'm including the code for my template. I used an existing Dreamweaver one column fixed page as a starting point, that's why there's all the explanatory copy in the code.

Thanks,
Rebecca



<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "<html xmlns="<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Untitled Document</title>
<style type="text/css">
<!--
body {
margin: 0;
padding: 0;
font-family: Georgia, "Times New Roman", Times, serif;
font-size: 100%;
line-height: 1.4;
background-image: url(../images/background_top.gif);
width: 860px;
}

/* ~~ Element/tag selectors ~~ */
ul, ol, dl { /* Due to variations between browsers, it's best practices to zero padding and margin on lists. For consistency, you can either specify the amounts you want here, or on the list items (LI, DT, DD) they contain. Remember that what you do here will cascade to the .nav list unless you write a more specific selector. */
padding: 0;
margin: 0;
}
h1, h2, h3, h4, h5, h6, p {
margin-top: 0; /* removing the top margin gets around an issue where margins can escape from their containing div. The remaining bottom margin will hold it away from any elements that follow. */
padding-right: 15px;
padding-left: 15px; /* adding the padding to the sides of the elements within the divs, instead of the divs themselves, gets rid of any box model math. A nested div with side padding can also be used as an alternate method. */
}
a img { /* this selector removes the default blue border displayed in some browsers around an image when it is surrounded by a link */
border: none;
}

/* ~~ Styling for your site's links must remain in this order - including the group of selectors that create the hover effect. ~~ */
a:link {
color:#414958;
text-decoration: underline; /* unless you style your links to look extremely unique, it's best to provide underlines for quick visual identification */
}
a:visited {
color: #4E5869;
text-decoration: underline;
}
a:hover, a:active, a:focus { /* this group of selectors will give a keyboard navigator the same hover experience as the person using a mouse. */
text-decoration: none;
}

/* ~~ this container surrounds all other divs giving them their percentage-based width ~~ */
.container {
width: 860px;/* a min-width may be desirable to keep this layout from getting too narrow. This keeps line length more readable in the side columns. IE6 does not respect this declaration. */
background: #FFF; /* the auto value on the sides, coupled with the width, centers the layout. It is not needed if you set the .container's width to 100%. */
margin-left: auto;
margin-right: auto;
margin-top: 0px;
margin-bottom: 0px;
}

/* ~~the header is not given a width. It will extend the full width of your layout. It contains an image placeholder that should be replaced with your own linked logo~~ */
.header {
background-image: url(../images/header_fill.gif);
background-repeat: no-repeat;
background-position: right top;
}

/* ~~ This is the layout information. ~~

1) Padding is only placed on the top and/or bottom of the div. The elements within this div have padding on their sides. This saves you from any "box model math". Keep in mind, if you add any side padding or border to the div itself, it will be added to the width you define to create the *total* width. You may also choose to remove the padding on the element in the div and place a second div within it with no width and the padding necessary for your design.

*/
.content {
padding: 10px 0;
margin-left: auto;
margin-right: auto;
}

/* ~~ This grouped selector gives the lists in the .content area space ~~ */
.content ul, .content ol {
padding: 0 15px 15px 40px; /* this padding mirrors the right padding in the headings and paragraph rule above. Padding was placed on the bottom for space between other elements on the lists and on the left to create the indention. These may be adjusted as you wish. */
margin-left: auto;
margin-right: auto;
}

/* ~~ The footer ~~ */
.footer {
background-color: #ece8d8;
background-image: url(../images/baseline_w_content.gif);
background-repeat: no-repeat;
height: 28px;
padding-right: 0;
padding-left: 0;
}

/* ~~ miscellaneous float/clear classes ~~ */
.fltrt { /* this class can be used to float an element right in your page. The floated element must precede the element it should be next to on the page. */
float: right;
margin-left: 8px;
}
.fltlft { /* this class can be used to float an element left in your page. The floated element must precede the element it should be next to on the page. */
float: left;
margin-right: 8px;
}
.clearfloat { /* this class can be placed on a <br /> or empty div as the final element following the last floated div (within the #container) if the #footer is removed or taken out of the #container */
clear:both;
height:0;
font-size: 1px;
line-height: 0px;
}
-->
</style>
<script src="../SpryAssets/SpryMenuBar.js" type="text/javascript"></script>
<link href="../SpryAssets/SpryMenuBarHorizontal.css" rel="stylesheet" type="text/css" />
<style type="text/css">
#apDiv1 {
left:260px;
top:21px;
width:860px;
height:36px;
z-index:3;
}
#apDiv2 {
top:35px;
width:860px;
height:65px;
margin-left: auto;
margin-right: auto;
}
</style>
</head>

<body>
<a href=" src="../images/purchase_button2.gif" alt="purchase tickets" width="98" height="87" align="right" longdesc=" /></a>
<div class="container">
<div class="header"><a href="../mainpage.html"><img src="../images/logo.gif" alt="Insert Logo Here" name="Insert_logo" width="199" height="87" id="Insert_logo" style="background: #8090AB; display:block;" /></a><!-- end .header --></div>
<ul id="MenuBar1" class="MenuBarHorizontal">
<li><a href="../about.html">about us</a> </li>
<li><a href="#" class="MenuBarItemSubmenu">tour information</a>
<ul>
<li><a href="../tour.html">2011 tour</a></li>
<li><a href="../homes.html">2011 homes</a></li>
<li><a href="../tickets.html">tickets</a></li>
<li><a href="../vip.html">vip program</a></li>
<li><a href="../boutique.html">boutique</a></li>
<li><a href="../advertising.html">advertising</a></li>
</ul>
</li>
<li><a class="MenuBarItemSubmenu" href="#">grants</a>
<ul>
<li><a href="../grants.html">grant recipients</a> </li>
<li><a href="../grantapps.html">grant applications</a></li>
</ul>
</li>
<li><a href="../news.html">in the news</a></li>
<li><a href="../contact.html">contact us</a></li>
</ul>
<div class="content"><!-- TemplateBeginEditable name="EditRegion1" -->
<h1><img src="../images/content_image_kitchen2.gif" width="833" height="371" alt="content" /></h1>
<p>&nbsp;</p>
<p>CSL supports non-profit agencies in Alameda and Contra Costa Counties that serve at-risk children. <br />
<span class="container">Our annual fundraiser, the Heart of the Home Tour, will take place on April 29 and 30 2011. </span> </p>
<!-- TemplateEndEditable -->
<p class="container"><!-- end .content --></p>
</div>
<div class="footer">
<h5><a href="../mainpage.html">(return to main page)</a></h5>
<!-- end .footer --></div>
<!-- end .container --></div>
<script type="text/javascript">
var MenuBar1 = new Spry.Widget.MenuBar("MenuBar1", {imgDown:"SpryAssets/SpryMenuBarDownHover.gif", imgRight:"SpryAssets/SpryMenuBarRightHover.gif"});
</script>
</body>
</html>
 
...this bit at the very top of the code, remove this line in your css:

body {
margin: 0;
padding: 0;
font-family: Georgia, "Times New Roman", Times, serif;
font-size: 100%;
line-height: 1.4;
background-image: url(../images/background_top.gif);
[COLOR=red yellow]width: 860px;[/color]
}


andrew

============
============
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top