Jump to content

Recommended Posts

I'm creating some hover menus where I want the hover menus to expand out in width to fit whatever the line items are on one line, but the width seems to be getting controlled by the previous menu. The only way I can seem to get it to work is if I give the hover ul a set width rather than trying to let it do it automatically. It seems like I'm just doing something wrong. I'm attaching two screenshots on how it looks now and how I want it to look. Here is my css-related code:

 

/* the top level menu bar */
ul.nice-menu {
border-top:none;
background: #971e20;
width: 970px;
height: 26px;
}

/* the top menu li's */
ul.nice-menu-down li,
ul.nice-menu-down li.menuparent {
border-top:none;
font-weight: normal;
font-size: 14px;
background: #971e21;
border-left: none;
border-bottom: none;
}

ul.nice-menu-down .menuparent a {
padding-right: 38px;
}

ul.nice-menu-down li a {
display:block;
padding:5px 38px;
}
}

ul.nice-menu li,
ul.nice-menu-down li.menuparent {
background: #971e20;
border: none;
border-right: 1px solid #fff;
}

ul.nice-menu li.last {
border-right: none;
}

/* top menu hovers */

ul.nice-menu-down li.menuparent:hover,
ul.nice-menu li:hover{
background: #80191b;
}

/* second (hover) ul **/
ul.nice-menu ul {
top: 26px;
background: #3c529b;
}

ul.nice-menu ul li {
width: auto;
padding: 0;
background: #3c529b;
}

ul.nice-menu ul li a {
padding: 5px 10px 5px 20px;
}

 

[attachment deleted by admin]

Link to comment
https://forums.phpfreaks.com/topic/207862-auto-width-on-hover/
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.