Results 1 to 2 of 2

Thread: horizontal li problem

  1. #1
    Join Date
    Feb 2007
    Posts
    36
    Thanks
    4
    Thanked 0 Times in 0 Posts

    Default horizontal li problem

    I'm trying to learn how to style lists. I have a vertical list that looks fine. But when I try to make it horizontal by adding display:inline; to the li, it doesn't change. Can anyone help? Thx in advance

    the html
    Code:
    <ul id="menu">
      <li>
        <a href="#nogo">link1</a>
      </li>
      <li>
        <a href="#nogo">link2</a>
      </li>
      <li>
        <a href="#nogo">link3</a>
      </li>
      <li>
        <a href="#nogo">link4</a>
      </li>
      <li>
        <a href="#nogo">link5</a>
      </li>
    </ul>
    the vertical css
    Code:
    #menu {
      padding:0;  /*removed indentation of normal ul for FF*/
      margin:0;    /*removed indentation of normal ul for IE*/
      width:0; /* makes it only as wide as itself, not width of page */
      }
    #menu li {
      list-style-type:none;    /*removed bullets of normal li*/
      }
    #menu a, #menu a:visited {
      display:block;   /*without this, the box would just go snugly around each word*/
      width:150px;
      border:1px solid #808;
      }
    #menu a:hover {
      background:#ddd;
      color:#808;
      }
    my failed attempt at horizontal li
    Code:
    #menu {
      padding:0;  /*removed indentation of normal ul for FF*/
      margin:0;    /*removed indentation of normal ul for IE*/
      width:0; /* makes it only as wide as itself, not width of page */
      }
    #menu li {
     display:inline;    /*this line should make it horizontal but doesnt*/
      list-style-type:none;    /*removed bullets of normal li*/
      }
    #menu a, #menu a:visited {
      display:block;   /*without this, the box would just go snugly around each word*/
      width:150px;
      border:1px solid #808;
      }
    #menu a:hover {
      background:#ddd;
      color:#808;
      }

  2. #2
    Join Date
    May 2007
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    This will work.You must define where you want your border to be.
    Code:
    #menu {
      padding:0;  /*removed indentation of normal ul for FF*/
      margin:0;    /*removed indentation of normal ul for IE*/
      width:0; /* makes it only as wide as itself, not width of page */
      }
    #menu li {
     display:inline;    /*this line should make it horizontal but doesnt*/
     list-style-type:none;    /*removed bullets of normal li*/
      }
    #menu a, #menu a:visited {
      /*display:block;   /*without this, the box would just go snugly around each word*/
      width:150px;
      border-left:1px solid #808;/* here is what I add
      }
    #menu a:hover {
      background:#ddd;
      color:#808;
      }
    I hope that I cud help.

Bookmarks

Posting Permissions

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