2 Replies Latest reply on Mar 3, 2010 7:12 AM by marginedout

    Need help-confused on top margin space with div in sidebar div

    marginedout

      Hello,

       

      I have tried for hours to figure out what is affecting the margin of the top right div #first_ad which is contained in #sidebar2. Right now I have that div first nav with 10px top that looks like 30 in IE7 and 40px in iIE8 (chrome, firefox are fine). I have tried 0 margin on p and h tags and other things to lord only knows what else. I just cannot see what is affecting this.

       

      If I could understand this it would be of great help as I seem to run into this alot with placing a div in a sidebar. I start out by using the dreamweaver templates in cs4 as my base.

       

      Here is the link to the page.

      http://www.hanovertypocraft.ca/test2/index3.html

       

      Thank you for any assistance you may give me!!

       

       

      below is the css

       

      @charset "UTF-8";

      body  {

      margin: 0; /* it's good practice to zero the margin and padding of the body element to account for differing browser defaults */

      padding: 0;

      text-align: center; /* this centers the container in IE 5* browsers. The text is then set to the left aligned default in the #container selector */

      color: #FFF;

      font-family: Verdana, Arial, Helvetica, sans-serif;

      font-size: 100%;

      background-color: #000;

      background-image: url(../images/hantypbg2.jpg);

      background-repeat: no-repeat;

      }

      .thrColFixHdr #container {

      width: 900px;

      text-align: left; /* this overrides the text-align: center on the body element. */

      margin-top: 50px;

      margin-right: auto;

      margin-bottom: 0;

      margin-left: auto;

      background-image: url(../images/container_bkgd.png);

      background-repeat: no-repeat;

      }

      .thrColFixHdr #header {

      padding: 0;

      height: 110px;

      margin: 0px;

      clear: none;

      float: left;

      width: 740px;

      }

      .thrColFixHdr #header h1 {

      margin: 0; /* zeroing the margin of the last element in the #header div will avoid margin collapse - an unexplainable space between divs. If the div has a border around it, this is not necessary as that also avoids the margin collapse */

      padding: 10px 0; /* using padding instead of margin will allow you to keep the element away from the edges of the div */

      }

      .thrColFixHdr #sidebar1 {

      float: left; /* since this element is floated, a width must be given */

      width: 165px; /* padding keeps the content of the div away from the edges */

      display: inline;

      }

      .thrColFixHdr #container #sidebar1 p {

      margin: 0px;

      padding: 0px;

      }

      #header #head_logo_text {

      height: 110px;

      width: 355px;

      margin-top: 0px;

      margin-bottom: 0px;

      margin-left: 225px;

      color: #FFF;

      font-size: 18px;

      font-family: Arial, Helvetica, sans-serif;

      font-weight: normal;

      clear: none;

      float: left;

      margin-right: 0px;

      padding: 0px;

      }

      #header #head_logo_text a {

      color: #FFF;

      }

      #header #head_logo_text p {

      font-family: Arial, Helvetica, sans-serif;

      font-size: 16px;

      line-height: 21px;

      margin: 0px;

      padding: 0px;

      }

      .thrColFixHdr #container #header img {

      margin: 0px;

      padding: 0px;

      }

      #nav_home {

      width: 135px;

      padding: 0px;

      margin-right: 15px;

      margin-bottom: 0px;

      margin-left: 15px;

      height: 320px;

      margin-top: 10px;

      }

      .thrColFixHdr #sidebar2 {

      float: right; /* since this element is floated, a width must be given */

      width: 140px; /* padding keeps the content of the div away from the edges */

      margin-right: 10px;

      padding: 0px;

      margin-top: 0px;

      margin-bottom: 0px;

      margin-left: 0px;

      background-color: #00F;

      }

      .thrColFixHdr #container #sidebar2 h1 {

      margin: 0px;

      padding: 0px;

      }

      .thrColFixHdr #container #sidebar2 p img {

      margin: 0px;

      padding: 0px;

      }

      .thrColFixHdr #container #sidebar2 p {

      margin: 0px;

      padding: 0px;

      }

      #mainContent {

      margin-top: 10px;

      margin-right: 160px;

      margin-bottom: 0;

      margin-left: 175px;

      padding-top: 0;

      padding-right: 10px;

      padding-bottom: 0;

      padding-left: 10px;

      }

      #mainContent p {

      font-family: Arial, Helvetica, sans-serif;

      text-align: center;

      font-weight: normal;

      font-size: 16px;

      line-height: 20px;

      margin: 0px;

      padding: 0px;

      }

      #mainContent #flash_div {

      width: 353px;

      margin-right: auto;

      margin-left: auto;

      border: 3px solid #000;

      height: 265px;

      overflow: hidden;

      }

      .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 */

      float: left;

      margin-right: 8px;

      }

      .clearfloat { /* this class should be placed on a div or break element and should be the final element before the close of a container that should fully contain a float */

      clear:both;

          height:0;

          font-size: 1px;

          line-height: 0px;

      }

      #sidebar2 #first_ad {

      height: 140px;

      margin-top: 10px;

      margin-bottom: 10px;

      border: 1px solid #000;

      }

      #sidebar2 #second_ad {

      height: 140px;

      margin-top: 10px;

      margin-bottom: 10px;

      border: 1px solid #000;

      }

      #sidebar2 #third_ad {

      height: 140px;

      margin-top: 10px;

      margin-bottom: 10px;

      border: 1px solid #000;

      }

      #sidebar2 #fourth_ad {

      height: 140px;

      margin-top: 10px;

      margin-bottom: 10px;

      border: 1px solid #000;

      }