Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • nadine 25 posts 75 karma points
    Nov 25, 2009 @ 07:39
    nadine
    0

    Dynamic horizontal navigation menu with unique images

    I'm trying to create a main navigation menu running horizontally accross the top of my page that has a unique image with the relevant link below it. I have added the images as a generic property of the web pages but I'm stumped on how I can get this to go horizontal.

    Do I have to resort to tables or has anyone been able to achieve this with CSS?

  • Jannik Nilsson 38 posts 81 karma points
    Nov 25, 2009 @ 08:59
    Jannik Nilsson
    0

    If the menu is in li's try float:left

  • Marius 22 posts 42 karma points
    Nov 25, 2009 @ 09:08
    Marius
    0

    Also try : display:inline

    for example

    #toplinks ul{
    display: inline;
    height: 100%;
    margin:0;
    padding: 0;
    list-style:none;
    }

    And use images for div inside li o as background for li.

    Marius.

  • nadine 25 posts 75 karma points
    Nov 25, 2009 @ 14:16
    nadine
    0

    I've tried these options and it works fine when it's just text but when there's images what I get is a horizontal list of menu items beside a horizontal group of images. Even though I specified the images first. It's much trickier than it should be.

    Marius I like your idea of images as the background, but how do I make this dynamic? Remember each image is associated with it's particular menu item.

  • dandrayne 1138 posts 2262 karma points
    Nov 25, 2009 @ 14:38
    dandrayne
    0

    There's probably something similar somewhere here -> http://www.cssplay.co.uk/menus/ ; everything is there!

    Dan

  • nadine 25 posts 75 karma points
    Nov 25, 2009 @ 16:20
    nadine
    0

    Thanks Dan there's a great selection of menus there but unfortunately none that fit what i'm trying to achieve.

    I've stripped out all my other styles as I found some were conflicting with the menu. Now I have a horizontal list with...

    image  text   image  text... (all bottom aligned)

    what I want to achieve is...

    image    image   image

    text         text       text

    my html goes like this...

    <ul class="menulinks">
        <li>
            <img...>
            <a href...>
        </li>
    ...
    </ul>

    my styles are...

    .menulinks{
     padding: 3px;
     margin: 0;
     display: inline;
     list-style-type:none;
     text-align: center;
     }
    .menulinks li {
     display: inline;
     margin: 0;
     }
    .menulinks li a {
     text-decoration: none;
     padding: 3px 7px;
     margin-right: 3px;
     }
    .menulinks li.selected a
    {
     position: relative;
     top: 1px;
     padding-top: 4px;
    }

     

     

     

  • nadine 25 posts 75 karma points
    Dec 03, 2009 @ 14:31
    nadine
    0

    Ok Folks in case you ever want the answer to this...

     

    Stylesheet

    #menu-contain
    {text-align:center;
     height:135px;
     background:url(../media/Assets/line.gif) repeat-x 0 43px;}

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

    #menulinks
    {padding:0;
     margin:0 auto;
     list-style:none;
     width:763px;}

    #menulinks li
    { float:left;
     text-transform:uppercase;}

    #menulinks li a
    { display:block;
     width:108px;
     margin-right:1px;
     font:normal 14px/16px verdana, arial, sans-serif;
     text-align:center;
     text-decoration:none;
     color:#024;}

    #menulinks li a img
    { display:block;
     border:0;
     margin:0 auto;
     padding-bottom:5px;}

    #menulinks li a:hover
    { font-weight:bold;}

     

     

     

     

     

Please Sign in or register to post replies

Write your reply to:

Draft