www.webdeveloper.com
Results 1 to 4 of 4

Thread: Weird <li>..</li> display in IE 7

  1. #1
    Join Date
    Mar 2010
    Posts
    3

    Weird <li>..</li> display in IE 7

    Hi,

    I have a rather interesting problem that I am experiencing in IE 7, I hope someone can shed some light on it.

    Take the following CSS:

    .sizesTable {
    margin: 0;
    padding: 0;
    }

    .sizesTable ul {
    margin: 0;
    padding: 0;
    list-style-type: none;
    list-style-image: none;
    }

    .sizesTable ul li.head {
    background-color: #000;
    padding: 3px;
    font-size: 12px;
    margin: 0 1px 0 0;
    display: block;
    float: left;
    text-align: center;
    }

    .sizesTable ul li.table {
    background-color: #cdd1d4;
    padding: 5px 3px;
    font-size: 12px;
    margin: 0 1px 0 0;
    float: left;
    text-align: center;
    color: #000;
    height: 19px;
    display: block;
    }

    .size {
    width: 81px;
    clear: both;
    }

    .steelheading {
    width: 70px;
    text-align: center;
    }

    .sizesTable ul li.table.steel {
    text-align: right;
    padding-right: 22px;
    width: 51px;
    }

    .description {
    width: 178px;
    }

    .descriptionwide {
    width: 266px;
    }

    .anchor.description {
    width: 211px;
    text-align: left;
    padding-left: 25px;
    }

    .productcode {
    width: 95px;
    text-align: left;
    padding-left: 14px;
    }

    .productcodenarrow {
    width: 95px;
    text-align: left;
    padding-left: 14px;
    margin-right: 6px;
    }

    .plastic {
    width: 162px;
    }


    **************************************************************

    ...and the following HTML:

    <?xml version="1.0" encoding="utf-8"?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
    <head>
    <meta http-equiv="content-type" content="text/html; charset=utf-8" />
    <meta http-equiv="Content-Style-Type" content="text/css">
    <link href="test.css" rel="stylesheet" type="text/css" />
    <title>table test</title>
    </head>
    <body>
    <h1>the full range of sizes are:</h1>
    <div class="sizesTable">
    <ul>
    <li class="head size">size (inch)</li>
    <li class="head steelheading">steel (mm)</li>
    <li class="head description">description</li>
    <li class="head productcode">product code</li>
    </ul>
    <ul>
    <li class="table size">22x16x13</li>
    <li class="table steel">8</li>
    <li class="table description">side entry frame</li>
    <li class="table productcode">CF2</li>
    </ul>
    <ul>
    <li class="table size">22x16x13</li>
    <li class="table steel">10</li>
    <li class="table description">side entry frame</li>
    <li class="table productcode">CF1</li>
    </ul>
    <ul>
    <li class="table size">24x16x14</li>
    <li class="table steel">8</li>
    <li class="table description">side entry frame</li>
    <li class="table productcode">CF7</li>
    </ul>
    <ul>
    <li class="table size">24x16x14</li>
    <li class="table steel">10</li>
    <li class="table description">side entry frame</li>
    <li class="table productcode">CF6</li>
    </ul>
    <ul>
    <li class="table size">25x18x15</li>
    <li class="table steel">8</li>
    <li class="table description">side entry frame</li>
    <li class="table productcode">CF12</li>
    </ul>
    <ul>
    <li class="table size">25x18x15</li>
    <li class="table steel">10</li>
    <li class="table description">side entry frame</li>
    <li class="table productcode">CF11</li>
    </ul>
    <ul>
    <li class="table size">27x18x15</li>
    <li class="table steel">8</li>
    <li class="table description">side entry frame</li>
    <li class="table productcode">CF17</li>
    </ul>
    <ul>
    <li class="table size">27x18x15</li>
    <li class="table steel">10</li>
    <li class="table description">side entry frame</li>
    <li class="table productcode">CF16</li>
    </ul>
    <ul>
    <li class="table size">34x20x16</li>
    <li class="table steel">10</li>
    <li class="table description">side entry frame</li>
    <li class="table productcode">CF33</li>
    </ul>
    <ul>
    <li class="table size">36x20x16</li>
    <li class="table steel">10</li>
    <li class="table description">side entry frame</li>
    <li class="table productcode">CF38</li>
    </ul>
    <ul>
    <li class="table size">40x22x17</li>
    <li class="table steel">10</li>
    <li class="table description">side entry frame</li>
    <li class="table productcode">CF46</li>
    </ul>
    <br />
    </div>
    </body>
    </html>


    **************************************************************


    Together this code will display a simple table with a heading above it. In most browsers the table displays correctly with the table rows 'butted up' together. However, in IE 7 there is a gap between each row.

    Initially, I presumed it was the age old problem of there being whitespace and carriage returns between each <li>...</li> element. Tested, no change!

    i then tried a few other CSS things including 'align-bottom', none of which worked.

    Now, try this, in the HTML, entirely remove the line '<h1>the full range of sizes are:</h1>' and the rows close up! Go figure!

    I am using IE 7.0.5730.13 for testing.

    If you test this in the same version of IE and don't experience the problem, please let me know. But, of course, I would really like to hear from anyone who can shed some light on to what on earth is going on here!

    Thanks loads, 4.

  2. #2
    Join Date
    Apr 2003
    Location
    Netherlands
    Posts
    21,654
    Clear the float:
    Code:
    ul {overflow:hidden;}
    Also, don't use the xml prolog, it puts IE6 into quirks mode.
    Last edited by Fang; 03-06-2010 at 06:37 AM.
    At least 98% of internet users' DNA is identical to that of chimpanzees

  3. #3
    Join Date
    Mar 2010
    Posts
    3

    Thank you...

    your help is much appreciated, that has solved the problem.

    I would still be interested to know why removing the <h1>...</h1> also resolved the problem, an element that should not be affecting the <div> below in anyway whatsoever!

    Thanks, 4.

  4. #4
    Join Date
    Apr 2003
    Location
    Netherlands
    Posts
    21,654
    The h1 margin affects the box model in IE. you could also do this:
    Code:
    <h1 style="margin:0;">the full range of sizes are:</h1>
    At least 98% of internet users' DNA is identical to that of chimpanzees

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles