-
Recently Browsing 0 members
- No registered users viewing this page.
-
Similar Content
-
- 2 replies
- 0 views
-
This mindblowing project lets you run Windows XP on the web
By Usama Jawad96,
- microsoft
- windows xp
- (and 4 more)
- 13 replies
- 0 views
-
HTML, CSS, & JavaScript All-in-One For Dummies (worth $39.99) free download ends today
By News Staff,
- ebook offer
- sponsored
- (and 3 more)
- 0 replies
- 0 views
-
Download HTML, CSS, & JavaScript All-in-One For Dummies ($39.99 Value, now FREE)
By News Staff,
- ebook offer
- sponsored
- (and 5 more)
- 0 replies
- 0 views
-
WordPress-Theme Twenty Twenty Four-customizing: how to do that - a Gutenberg special question...
By thedhubs,
- 2 answers
- 3201 views
-
Question
Axel
What I'm having difficulty with is that I want to make the menu do several things if it all possible:
1) Span the whole nav menu to the width of whatever the container div is.
2) Automatically space the list items in the top menu evenly without having to specify.
3) Wrap the text when required (only managed to achieve this so far by specifying width.)
4) When the menu item is a single word on a single line, align it vertically, not towards the top as it is now!
5) Ignoring the submenu items for the moment.
I've dumped the code here and you can see the current result:
http://jsfiddle.net/b2bUV/
css:
nav { font: bold 12px Arial, Helvetica; } nav ul ul { display: none } nav ul li:hover > ul { display: block; } nav ul { background: #e6e6e6; padding: 0px 0px ; border-radius: 5px; border-style: solid; border-width: 1px; border-color:b3b3b3; list-style: none; position: relative; display: inline-table; text-align: center; } nav ul:after { content: ""; clear: both; display: block; } nav ul li { float: left; width: 85.8px; height: auto; padding-left: 5px; padding-right: 5px; } nav ul li:hover { background: #c3c3c3; } nav ul li:hover a { color: #fff; } nav ul li a { display: block; padding: 10px 0px 10px 0px; height: 30px; color: #000; text-decoration: none; } nav ul ul { background: #b3b3b3; border-radius: 0px; padding: 0; position: absolute; top: 100%; } nav ul ul li { float: none; border-top: 1px solid #f2f2f2; border-bottom: 1px solid #f2f2f2; position: relative; padding: 0px; width: auto; height: auto; text-align: left; } nav ul ul li a { padding: 0px 0px 0px 0px; color: #fff; } nav ul ul li a:hover { background: #757575; } nav ul ul ul { position: absolute; left: 100%; top:0; }html:
Link to comment
https://www.neowin.net/forum/topic/1122814-help-with-css-nav-ul-li-drop-down-menu-alignm/Share on other sites
13 answers to this question
Recommended Posts