0

So basically, I have a menu at the top of my page:

| Menu 1 | Menu 2 | Menu 3 | Menu 4 |
                             Menu 4 Item 1
                             Menu 4 Item 2
                             Menu 4 Item 3

But I want to orient the last menu so that the menu items do not extend pass the screen, but instead expand backwards, such as:

| Menu 1 | Menu 2 | Menu 3 | Menu 4 |
                      Menu 4 Item 1
                      Menu 4 Item 2
                      Menu 4 Item 3

Maybe I'm just not searching the right keywords, but I can't figure out how to do this. Here is the code:

<div style="background: none repeat scroll 0 0 #383aff; clear: both; font-size: 13px; height: 36px; margin: auto; width: 100%;">
<ul style="margin: 0px; padding: 0px;">
<li>Menu Item 4 <ul style="display:none; position:absolute; z-index: 100;">
<li><a style="margin: 0px; padding: 0px;">Submenu Item 1</a></li>
<li><a style="margin: 0px; padding: 0px;">Submenu Item 2</a></li>
<li><a style="margin: 0px; padding: 0px;">Long Submenu Item ASDFASDFASDFASDFASDFASDFASDFASDF</a></li></ul></li>
<li>Menu Item 2</li>
<li>Menu Item 2</li>
<li>Menu Item 1</li>
</ul>
</div>

These two questions are similar, but not solutions.

Community
  • 1
  • 1
NobleUplift
  • 5,631
  • 8
  • 45
  • 87

1 Answers1

0

Something like this might work:

http://jsfiddle.net/mn6pj79L/

This only changes the last child of the mainmenu items

ul {
    width: 400px;
    display: inline;
    list-style-type: none;
    position: relative;
    padding-left: 1px;
    margin-left: -3px;
}

ul li { 
    float: left;
    width: 100px;
    border: 1px solid black;
    background-color: silver;
}

ul li ul {
    width: 150px;
    display: none;
    position: absolute;
    text-indent: 0px;
    margin: 0px;
    padding: 0px;
}

ul li ul li {
    width: 150px;
}

ul li:last-child ul {
    position: absolute;
    right: 0px;
}

ul li:hover ul {
    display: block;
}
Chris Laarman
  • 1,559
  • 12
  • 25