Forum Moderators: not2easy
I need some help.
What is the best way to handle a 0 margin for the header and footer, but standoff 8 pixels on the content only, and NOT have to use a marginwidth in the html body tag? - I have searched the net, but what I've found just doesn't work at all -it blows up everything.
When I've tried to use margins in the body css selector, I'm getting weird behavior regardless how I set them.
I have searched this forum, and viewed as many threads as I have time, but have not found anything specific to my needs.
Will someone please demonstrate to me how I can set my header and footer to be O px, but still be able to set up an offset of 8 px for my content div?
Thanks so much in advance.
thanks for your swift reply, and moreso your help.
I had already tried exactly what you posted, but it's still breaking. I say 'breaking', as the browser margins go back to default - no matter what I try to do with the style sheet, my margins look as if it's not even reading the styles at all [but I know it is]. Hope this makes sense.
I've checked against all modern browsers - but main tester is IE 5.1 for mac.
I can post a partial of my existing style sheet - maybe you might see something that I'm missing. [?]
Please excuse the depth here. Normally, desperate issues require desperate measures. [Length of selectors is long on the tooth until we narrow down styles.]
#body {
margin: 0px;
padding: 0px;
font-family: "Lucida Grande", Geneva, Verdana, Arial, Helvetica, sans-serif;
font-size: 10px;
font-style: normal;
line-height: normal;
font-weight: normal;
font-variant: normal;
text-transform: none;
color: #000000;
background-color: #eeeeee;
}
#header {
width: 100%;
height: 76px;
background: #ffffff url(/images/header_back.png) repeat top left;
margin-left: 0px;
margin-right: 0px;
margin-top: 0px;
margin-bottom: 0px;
padding: 0px;
padding-right: 0px
}
#logo {
float:left;
width: 196px;
height: 76px;
background: transparent url(/images/ms_logo.png) no-repeat top left;
color: #ffffff
}
#subheader {
width: 100%;
height: 18px;
background: url(/images/headgraphic.png) repeat top left;
margin-left: 0px;
margin-right: 0px;
margin-top: 0px;
margin-bottom: 0px;
padding: 0px;
font-family: "Lucida Grande", Geneva, Verdana, Arial, Helvetica, sans-serif;
font-size: 10px;
font-style: normal;
line-height: normal;
font-weight: bold;
font-variant: normal;
text-transform: none
}
#container {
margin: 0px;
padding: 8px;
background: #eeeeee;
}
#content {
padding-right: 0px;
margin-right: 308px;
background : #eeeeee;
}
#sidenav {
float: right;
width: 300px;
margin-top: 0px;
margin-right: 0px;
margin-bottom: 5px;
margin-left: 14px;
padding-top: 0px;
padding-right: 0px;
padding-bottom: 0px;
padding-left: 0px;
border-top-width: 0px;
border-right-width: 0px;
border-bottom-width: 0px;
border-left-width: 0px;
border-top-style: solid;
border-right-style: solid;
border-bottom-style: solid;
border-left-style: solid;
border-left-color: #8B8A8B;
border-top-color: #8B8A8B;
border-right-color: #8B8A8B;
border-bottom-color: #8B8A8B;
font-family: "Lucida Grande", Geneva, Verdana, Arial, Helvetica, sans-serif;
font-size: 10px;
font-style: normal;
line-height: normal;
font-weight: normal;
font-variant: normal;
text-transform: none;
color: #000000;
background-color: #eeeeee;
}
#subfooter {
clear: both;
padding: 0px;
margin-top: 5px;
margin-bottom: 5px;
font-family: "Lucida Grande", Geneva, Verdana, Arial, Helvetica, sans-serif;
font-size: 10px;
font-style: normal;
line-height: normal;
font-weight: normal;
font-variant: normal;
text-transform: none;
color: #000000;
background: #eeeeee;
}
#footer {
clear: both;
padding: 5px;
margin-top: 0px;
background: #eeeeee;
border-top: 1px #2F44BE solid;
}
Page code:
<?php include "$DOCUMENT_ROOT/includes/ms_header.inc";?>
<!--container-->
<div id="container">
<!--nav-->
<div id="sidenav">
<?php include "$DOCUMENT_ROOT/includes/ms_nav.inc";?>
<?php include "$DOCUMENT_ROOT/includes/ms_subnav.inc";?>
</div>
<!--end nav-->
<!--content-->
<div id="content">
</div>
<!--end content-->
<div id="subfooter" align="right"></div>
<?php include "$DOCUMENT_ROOT/includes/ms_footer.inc";?>
</div>
<!--end container-->
<div class="header"></div>
<div class="container">
<div class="content"></div>
<div class="sidebar"></div>
</div>
<div class="footer"></div>
Yes? If so, you might try wrapping just the content <div> in another <div> (say, <div class="wrapper">) and give that containing <div> the padding and/or margin of 8px.
<div class="header"></div>
<div class="container">
<div class="wrapper">
<div class="content"></div>
</div>
<div class="sidebar"></div>
</div>
<div class="footer"></div>
Please don't use filename.inc for your includes.
If someone enters that URL in a browser, they will simply see the full text of your .inc file since it's not processed as php.
A better habit is to use
filename.inc.php
To make sure the php code inside the .inc file is processed and not available to the outside world.
I'll take a closer look at your CSS to see if I have any suggestions on that part..