1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Hi, can't get my menu to line up, can you help?

Discussion in 'HTML & Website Design' started by twelfty, Nov 5, 2015.

  1. #1
    Hi, I'm having trouble getting my menu to behave.

    The top line/items are all fine, but I can't quite get the dropdowns to behave.

    Can anyone help please? Menu is on here:

    http://www.formybike.co.uk/index.ntml

    Many thanks in advance.
     
    twelfty, Nov 5, 2015 IP
  2. twelfty

    twelfty Active Member

    Messages:
    361
    Likes Received:
    10
    Best Answers:
    0
    Trophy Points:
    90
    #2
    I suppose this would help too:


    how-it-should-look.png
     
    twelfty, Nov 5, 2015 IP
  3. deathshadow

    deathshadow Acclaimed Member

    Messages:
    9,732
    Likes Received:
    1,998
    Best Answers:
    253
    Trophy Points:
    515
    #3
    Considering you don't even have a site at that URI, kind of hard to help you. Laugh is your index.html is just some empty scripttardery, but if you try to access the host domain it 403's? :/
     
    deathshadow, Nov 5, 2015 IP
  4. webcosmo

    webcosmo Notable Member

    Messages:
    5,840
    Likes Received:
    153
    Best Answers:
    2
    Trophy Points:
    255
    #4
    you should have html structure like:
    <ul>
    <li><a href="#">SERVICES</a>
    <ul>
    <li><a href="#">DROPDOWN ONE</a></li>
    <li><a href="#">DROPDOWN 2</a></li>
    <li><a href="#">DROPDOWN 3</a></li>
    </ul>
    </li>
    <ul>

    css would be like(position relative and position absolute are crucial):
    ul {list-style: none;padding: 0px;margin: 0px;}
    ul li {display: block;position: relative;float: left;}
    li ul {display: none;}
    ul li a {display: block;padding: 10px;text-decoration: none;white-space: nowrap;}
    li:hover ul {display: block; position: absolute;}
    li:hover li {float: none;}
    #drop-nav li ul li {border-top: 0px;}
     
    webcosmo, Nov 6, 2015 IP
  5. qwikad.com

    qwikad.com Illustrious Member Affiliate Manager

    Messages:
    7,151
    Likes Received:
    1,656
    Best Answers:
    29
    Trophy Points:
    475
    #5
    qwikad.com, Nov 6, 2015 IP
  6. deathshadow

    deathshadow Acclaimed Member

    Messages:
    9,732
    Likes Received:
    1,998
    Best Answers:
    253
    Trophy Points:
    515
    #6
    One problem with both the code answers given so far is that both use display:none; -- This can prevent some screen readers like JAWS or even some search engines from obeying the menu and/or spidering the links inside it. TECHNICALLY neither should pay any attention to the CSS, but thanks to people abusing it for hidden content search has been paying attention to display:none in the screen media for about a decade now.

    The more preferred approach is to either use a negative left position to slide it off the screen, or overflow:hidden. I prefer the latter as it has no repositioning issues in legacy IE and is typically easier to code.

    Loosely based on @qwikad.com's HTML.

    http://www.cutcodedown.com/for_others/twelfty/template.html

    The directory is unlocked for easy access to the gooey bits and pieces:
    http://www.cutcodedown.com/for_others/twelfty/

    As I use overflow:hidden and overflow:visible on the LI:hover state it ends up far simpler than the display:none method, without any of the headaches of "why aren't pages linked to in my menu indexing?"

    That said, I've abandoned dropdowns of more than single depth since they are rubbish usability on touch-screens. It's an outdated concept that was never very good from a usability/accessibility standpoint in the first place.
     
    deathshadow, Nov 6, 2015 IP