views:

30

answers:

1

Hey, I've a very funny problem. I have a very loong ul li a menu and want to have ONE item with different width and height.

The menu looks like this:

<ul id="nav">
  <li id="smaller"><a href="#" id="smallerLink">The smallest item</a></li>
  <li><a href="#">Another item</a></li>
  <li><a href="#">Another item</a></li>
  <li><a href="#">Another item</a></li>
  (...)
</ul>

Then I have something like in:

style.css:

#nav {
  list-style-type: none;
}

#nav li {
  display: inline-block;
  line-width: 2em;
  width: 20px;
  height: 20px;
}

#nav li a {
  display: inline-block;
  width: 20px;
  height: 20px;
}

#smaller {
  width: 10px;
  height: 10px;
}

#smallerLink {
  width: 10px;
  height: 10px;
}

Why the first item isn't 10x10px?

+2  A: 

Because it contains an a-tag with width and height of 20px. Set overflow:hidden on your #smaller css definition, then it should work. And make it #nav li#smaller for greater specifity.

#nav li#smaller {
    width: 10px;
    height: 10px;
    overflow: hidden
}
Dave
You're wrong. a tag has #smallerLink ID.
aldona
Then please post the CSS Definition for #smallerLink...
Dave
If you change `#smaller` to `#nav li#smaller` like I wrote in my answer, then it should work.
Dave