Skip to content
View in the app

A better way to browse. Learn more.

Web Designer Forum

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

li menu problem

Featured Replies

creating a menu but can't get it to work ....... the li's won't stretch to 100%

 

#nav ul
{
position:absolute;
left:0px;
list-style: none;
margin: 0;
padding: 0;
border: none;
width:100%;
}
#nav li
{
width:100%;
border-bottom: 1px solid #90bade;
list-style-type:none;
margin: 0;
padding:0;
}
#nav li a
{
display: block;
margin:0;
padding: 5px 5px 5px 0.5em;
border-left: 10px solid #1958b7;
border-right: 10px solid #508fc4;
background-color: #2175bc;
color: #fff;
text-decoration: none;
width: 100%;
}
html>body #nav li a { width: auto; }
#nav li a:hover
{
border-left: 10px solid #1c64d1;
border-right: 10px solid #5ba3e0;
background-color: #2586d7;
color: #fff;
}

 

http://www.dadelandexecutiveofficesuites.com/wordpress/

Have you declared an appropriate width for the div #nav?

 

I haven't had a chance to look through the code but is there a reason that the #nav ul is position absolutely?

 

I would wipe the slate clean with the css you have and start over on that section. If its a fixed layout, avoiding %'s might make it easier for you.

  • Author

Have you declared an appropriate width for the div #nav?

 

I haven't had a chance to look through the code but is there a reason that the #nav ul is position absolutely?

 

I would wipe the slate clean with the css you have and start over on that section. If its a fixed layout, avoiding %'s might make it easier for you.

 

im trying different things to get it to work, the ul & li displays to the right of the div, when its supposed to be 100% width, as i have put

A simple mistake, but it took me ages to find it after messing about with the styles.

 

 

Your style is

#nav ul

{

position:absolute;

left:0px;

list-style: none;

margin: 0;

padding: 0;

border: none;

width:100%;

}

 

where the ul is after #nav but your markup is <ul id="nav"> where the ul is before the nav so delete ul in the style

#nav /*ul*/

{

position:absolute;

left:0px;

list-style: none;

margin: 0;

padding: 0;

border: none;

width:100%;

}

 

The li tags are OK because they are after the #nav id.

 

I would also add left: 0; to the style for #sidebar although it isn't necessary because browsers assume 0 if not stated but position: absolute should have horizontal and vertical positions.

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.