Results 1 to 2 of 2

Thread: horizontal list

  1. #1
    Member sudhakararaog's Avatar
    Join Date
    Sep 2009
    Posts
    224

    Default horizontal list 2 Jan 2010 @ 08.35

    please refer to this link

    Horizontal List

    i have set a background of #555 for the div containing the list and #ccc for each list items, for the last list item about us based on the amount of padding and margin i have applied there is a small gap left over

    my question is if i want the last list item to cover the remaining gap, other than creating a class for the last list item and specifying a different value of padding so that the last list item occupied the remaining gap

    is there any other way or creating a separate class for the list item is the only way

    please advice.

    thanks
      Reply With Quote

  2. #2
    Senior Member stu2000's Avatar
    Join Date
    Jan 2009
    Posts
    566

    Default 2 Jan 2010 @ 09.48

    The only way I can think is to give the last menu item a different class to the rest of them, with no margin, and then decrease the width of the holding div. Eg:

    Change the following in the CSS:

    Code:
    #topmenu{
        float: left;
        width: 894px;
        height: auto;
        background: #555;
    }
    
    #topmenu ul li a{
    color: #000;
    text-decoration: none;
    background: #ccc;
    display: block;
    padding: 11px 15px 12px 28px;
    }
    Add the following:

    Code:
    .menuitem {
     margin: 0 5px 0 0;
    }
    
    .lastitem {
     margin: 0;
    }
    And change the list to:

    HTML Code:
    <ul>
            <li class="menuitem"><a href="#">Home</a></li>
    
            <li class="menuitem"><a href="#">Job Search</a></li>
            <li class="menuitem"><a href="#">Advertisers Employers</a></li>
            <li class="menuitem"><a href="#">Immigration Resources</a></li>
            <li class="menuitem"><a href="#">Education Training</a></li>
            <li class="menuitem"><a href="#">Contact Us</a></li>
            <li class="lastitem"><a href="#">About Us</a></li>
    
          </ul>
    Not perfect by a long shot, but it displays how you are wanting it to!

    Stu
      Reply With Quote

Similar Threads

  1. horizontal list
    By sudhakararaog in forum HTML & CSS
    Replies: 2
    Last Post: 7 May 2010, @ 05.24
  2. horizontal list
    By sudhakararaog in forum HTML & CSS
    Replies: 1
    Last Post: 28 Apr 2010, @ 08.07
  3. horizontal list
    By sudhakararaog in forum HTML & CSS
    Replies: 6
    Last Post: 14 Apr 2010, @ 05.08
  4. horizontal list
    By sudhakararaog in forum HTML & CSS
    Replies: 2
    Last Post: 31 Mar 2010, @ 07.30
  5. horizontal list
    By sudhakararaog in forum HTML & CSS
    Replies: 0
    Last Post: 26 Dec 2009, @ 04.55

Tags for this Thread

Posting Permissions

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