Results 1 to 9 of 9

Thread: css problem with ul.menu li."class"

  1. #1
    Join Date
    May 2008
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default css problem with ul.menu li."class"

    Hey, Im trying to create a class for my ul.menu li for a menu Im using.

    it looks like this: (its the ul.menu li.first)

    css:
    Code:
    ul.menu {
    list-style-type:none;
    width:798px;
    position:relative;
    display:block;
    height:33px;
    font-size:.6em;
    background:url(images/bg.png) repeat-x top left;
    font-family:Verdana,Helvetica,Arial,sans-serif;
    border:1px solid #000;
    margin:0;
    padding:0;
    }
    
    ul.menu li {
    display:block;
    float:left;
    margin:0;
    padding:0;
    }
    
    ul.menu li.first { 
    display:block;
    float:left;
    margin:0;
    padding:0;
    border-right:1;
    }
    
    ul.menu li a {
    float:left;
    color:#A79787;
    text-decoration:none;
    height:24px;
    padding:9px 15px 0;
    }
    
    ul.menu li a:hover,.current {
    color:#fff;
    background:url(images/bg.png) repeat-x top left;
    }
    
    ul.menu .current a {
    color:#fff;
    font-weight:700;
    }
    
    
    /*GREEN*/
    ul.menu.green{
    background-color:#629600;
    }
    ul.menu.green li a:hover, .menu.green li.current {
    background-color:#7AB900;
    }

    and on the header.php Im having this:

    Code:
    <center><ul class='menu green'>
    <li><a href='http://www.link.com'>link1</a></li>
    <li><a href='http://www.link.com'>link2</a></li>
    <li><a href='http://www.link.com'>link3</a></li>
    <li class='first'><a href='http://www.link.com'>link4</a></li>
    <li><a href='http://www.link.com'>link5</a></li>
    <li class='first'><a href='http://www.link.com'>link6</a></li><li><a href='http://www.link.com'>link</a></li>
    
    	</ul></center>
    And what I want to achieve is to create a divider between link 4-5 and 5-6. At first I was using <p>|</p> but didnt like the outcome really.

    Any help would be great.

    Cheers

    (edit: forgot the code function)
    (edit: and ofc that two section is not the entire code but just the only thing concerning the menu)
    (edit: bah maybe I shouldnt be in such a hurry..the current outcome is that the border isnt showing on the li class)
    Last edited by acwder; 05-10-2008 at 04:59 PM.

  2. #2
    Join Date
    May 2007
    Location
    By the beach
    Posts
    23
    Thanks
    0
    Thanked 3 Times in 3 Posts

    Default

    Fast Solution:

    Add the following under your current CSS:

    Code:
    .dv{
    	font-size:20px;
    }

    Add the following after the A element in your LI:

    HTML Code:
    <span class="dv">|</span>
    E.g.

    HTML Code:
    <li class='first'><a href='http://www.link.com'>link4</a><span class="dv">|</span></li>

    Live Example: http://phpscriptindex.com/dynamicdrive_help/ulmenu.html
    Tested in IE 7 and Firefox

  3. #3
    Join Date
    May 2008
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    thanks I'll do that

  4. #4
    Join Date
    Mar 2007
    Location
    Currently: New York/Philadelphia
    Posts
    2,735
    Thanks
    3
    Thanked 519 Times in 507 Posts

    Default

    Tested in IE 7 and Firefox
    A little heads up. It doesn't work in Opera but does work in IE6 and Safari as well.

    I would probably use borders instead of the vertical bar. It's a bit cleaner.

  5. #5
    Join Date
    May 2008
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    here is the outcome btw, http://www.orkfia-portal.com, still got some work to redo the colors, green + orange = not so good

    Thanks for the help again.

  6. #6
    Join Date
    May 2008
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Im really a newbie on css so kinda limited to know whats possible and such

  7. #7
    Join Date
    May 2007
    Location
    By the beach
    Posts
    23
    Thanks
    0
    Thanked 3 Times in 3 Posts

    Default

    Example for border:

    Add to bottom of CSS:

    Code:
    #dv{
    	border-right:1px solid black;
    }
    Add dv class to LI Element:

    E.g.

    HTML Code:
    <li class='first' id='dv'><a href='http://www.link.com'>link4</a></li>
    View live here: http://www.phpscriptindex.com/dynami...p/ulmenu2.html

  8. #8
    Join Date
    Mar 2007
    Location
    Currently: New York/Philadelphia
    Posts
    2,735
    Thanks
    3
    Thanked 519 Times in 507 Posts

    Default

    Quote Originally Posted by phpsales View Post
    Example for border:

    Add to bottom of CSS:

    Code:
    #dv{
    	border-right:1px solid black;
    }
    Add dv class to LI Element:

    E.g.

    HTML Code:
    <li class='first' id='dv'><a href='http://www.link.com'>link4</a></li>
    View live here: http://www.phpscriptindex.com/dynami...p/ulmenu2.html
    Much better than the vertical bar you suggested before.

  9. #9
    Join Date
    May 2008
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    yeah Im using that one now instead thx replace "black" with "green" tho, hmm oh well thanks again

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
  •