Chris
Chris

Reputation: 374

HTML CSS Lists in IE7

I don't normally work with IE7 simply because I hate it, but my latest client uses IE7-IE9 as their default browsers (not very consistent or up-to-date I know). So I have a list that renders fine in all newer browsers and IE8+ but in IE7 the UL seem to merge into the LI. Its like the tag didn't exist and the UL was a part of the LI. Each list item is nested inside of the one on top of it. Its hideous. Anyone know of a hack or a way around this? Is my CSS messed up?

<div class="indentList">
<ul class="level1">
<li class="customer">
    <a href="">Title</a>
</li>
<ul class="level2 level" id="level2">
    <li class="site">
        <a href="">Text</a>
    </li>
    <ul class="level3 level" id="level3">
        <li class="engineer indent">
            <a href="">Name</a>
        </li>
    </ul>
<ul class="level2 level" id="level2">
    <li class="site">
        <a href="">Text</a>
    </li>
    <ul class="level3 level" id="level3">
        <li class="engineer indent">
            <a href="">Name</a>
        </li>
        <ul class="level4 level" id="level4">
            <li>
                <a href="">Item</a>
            </li>
            <li>
                <a href="">Item</a>
            </li>
        </ul>
    </ul>
</ul>
</ul>
</div>

.indentList ul {
margin: 0px;
padding: 0px;
float: left;
}
.indentList li a {
    width: 770px;
    margin: 0px 0px;
    padding: 10px 0px;
    display: inline-block;
    float: left;
    }
.indentList li:hover {
    background: #E9E9E9;
    }
.indentList li a:hover {
    text-decoration: none;
    }
.indentList li .edit {
    -webkit-border-radius: 4px;
    -moz-border-radius: 4px;
    border-radius: 4px;
    padding: 5px 14px;
    width: auto !important;
    margin: 4px 0px 0px 5px;
    text-align: center;
    display: inline;
    position: relative;
    float: right;
    }
.indentList li .edit.frozen {
    background: #b51a1a url('images/menuBackgroundRed.png') center;
    float: right;
    }
.indentList li.customer {
    background: #787878 url('images/menuBackgroundTaller.png') center;
    color: #FFF;
    box-shadow: inset 0px 0px 0px;
    -moz-box-shadow: inset 0px 0px 0px;
    -webkit-box-shadow: inset 0px 0px 0px;
}
    .indentList li.customer a {
        color: #FFF;
        font-family: 'QuicksandBook', Arial, sans-serif;
        font-size: 17px;
    }
.level2, .level3, .level4 {
    display: block;
    }
.indentList ul ul ul li {
    margin-left: 50px;
    width: 840px;
    }
    .indentList ul ul ul li a {
        width: 770px;
        }
.indentList ul ul ul ul li {
    margin-left: 90px;
    width: 800px;
    }
    .indentList ul ul ul ul li a {
        width: 730px;
        }

Upvotes: 1

Views: 387

Answers (1)

kei
kei

Reputation: 20481

Not your CSS, but your HTML is messed up.

You should be doing this (pseudocode):

<ul class="first-level">
  <li>
    <ul class="second-level">
      <li>
        <ul class="third-level">
          <li></li>
        </ul>
      </li>
    </ul>
  </li>
</ul>

instead of this:

<ul class="first-level">
  <li></li>
  <ul class="second-level">
    <li></li>
    <ul class="third-level">
      <li></li>
    </ul>
  </ul>
</ul>  

Upvotes: 1

Related Questions