boy oh boy, I need some help (please) - CSS

Ask a Question related to Macromedia Dynamic HTML, Design and Development.

  1. #1

    Default boy oh boy, I need some help (please) - RE: CSS

    Hello; I'm rather new to CSS-based layouts, and I'm aware that there are
    several issues with respect to bugs in IE, etc. (eg. 'box model' bug), and I'm
    wondering if what I'm experiencing derives from one of these problems.

    I'm attaching the code below that displays the issue; basically, I'm trying to
    create several distinct layout boxes with 5 pixel gaps in between (or 5 pixel
    padding surrounding each box); I have set up what seems to be an exceedingly
    simple layout and all browsers seem to render it as intended except for IE,
    which separates--inexplicably-- the "left" and "main" boxes by 8 pixels instead
    of 5---I cannot figure out for the life of me where these extra 3 pixels are
    coming from. (Also, this problem seems to deepen when borders are added, which
    I also want to include);

    Any help is GREATLY appreciated. And if anyone happens to have any suggestions
    for a totally different approach to achieving the same end, I'm all ears.
    Thanks much;

    Here's the code:

    / / / / / / / / / / / / / /



    <!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=iso-8859-1" />
    <title>Untitled Document</title>
    <style type="text/css">
    <!--
    body {
    font-size: 11px;
    font-family: Verdana, Arial, SunSans-Regular, Sans-Serif;
    padding:0px;
    margin:0px;
    }
    #container {
    width: 950px;
    margin-bottom: 10px;
    margin-left: auto;
    margin-right: auto;
    margin-top: 20px;
    }
    #banner {
    background-color: #e1ddd9;
    text-align: right;
    padding: 0px;
    margin: 0px;
    }
    #content {
    background-color: #d4d4d4;
    padding: 0px;
    margin-left: 285px;
    margin-right: 0px;
    margin-top: 5px;
    margin-bottom: 0px;
    height: 35px;
    }
    #content2 {
    background-color: #d4d4d4;
    padding: 0px;
    margin-left: 285px;
    margin-right: 0px;
    margin-top: 5px;
    margin-bottom: 0px;
    }
    div#content2 {
    min-height:400px;
    height:expression(this.scrollHeight > 400 ? "auto":"400px");
    }
    #left {
    float: left;
    width: 280px;
    margin-top: 5px;
    margin-right: 0px;
    margin-bottom: 0px;
    margin-left: 0px;
    background-color: #d4d4d4;
    height: 35px;
    }
    #left2 {
    float: left;
    width: 280px;
    margin-top: 5px;
    margin-right: 0px;
    margin-bottom: 0px;
    margin-left: 0px;
    background-color: #d4d4d4;
    clear: both;
    }
    -->
    </style>
    </head>

    <body>

    <div id="container">

    <div id="banner">banner</div>
    <div id="left">left_nav</div>
    <div id="left2">left_nav2</div>
    <div id="content">main content</div>
    <div id="content2">main content 2</div>

    </div>

    </body>
    </html>

    npish Guest

  2. #2

    Default Re: boy oh boy, I need some help (please) - RE: CSSlayout

    I've had the same problem with margins and I think it's easier to just use a spacer than putting browser hack in my code. Have a look at [url]http://nopeople.com/npish/[/url] and see what you think.
    Excavatorak Guest

  3. #3

    Default Re: boy oh boy, I need some help (please) - RE: CSSlayout

    thanks so much for your help, Excavatorak; since I made that post, I have done
    quite a lot of research on the matter, which is actually very well documented,
    and falls under the description of--the dreaded--"IE three pixel jog"; if
    you're not already aware of this, apparently IE--and only Win IE-- adds three
    extra pixels of padding alongside the content adjacent to a float; in my
    example, this was causing the text to "indent" three pixels in the "content"
    sections;

    there are a variety of ways to approach this bug--and I will post links below
    to the most helpful pages that I came across--and I ultimately decided to go
    with the option whereby BOTH blocks are left floated ("left nav" and "main
    content"), thus eradicating the problem altogether (I also tried various hacks
    targeted at WinIE, but the aforementioned approach was the most simple);

    I thank you for your input, however, as it is always good to be aware of
    multiple solutions; also, I have a question for you regarding the edits you
    made to the code: what is the purpose exactly of the "clear" class that you
    appended to the bottom of the layout?

    Thanks again,

    _Nick

    ///////////////// links documenting the "IE Three Pixel Jog" issue, along with
    various solutions:

    [url]http://positioniseverything.net/explorer/threepxtest.html[/url]

    [url]http://www.sitepoint.com/forums/showpost.php?p=1374925&postcount=15[/url]



    npish Guest

  4. #4

    Default Re: boy oh boy, I need some help (please) - RE: CSSlayout

    To make the #container div enclose the floats. See [url]http://www.cs.hmc.edu/~mbrubeck/clear-after/[/url]
    Excavatorak Guest

  5. #5

    Default Re: boy oh boy, I need some help (please) - RE: CSSlayout

    Check [url]http://nopeople.com/npish/[/url] now. I used your 3px fix and it works.
    Have you tried adding content to it yet?
    Excavatorak Guest

  6. #6

    Default Re: boy oh boy, I need some help (please) - RE: CSSlayout

    thanks for the link; I have added content using the double-float approach, and
    so far, so good; I'll let you know if any issues arise; my only trouble now is
    my template updating/creating files very sluggishly in DW 8, but that's another
    issue entirely.........

    npish Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139