PDA

View Full Version : css linebreak



jschnyderite
22 Jan 2010, 11:02 AM
I'm working with a suckerfish menu. I expanded the submenu to 100% width of its parent (the main menu category title), but if I have a very long menu title and 2 short submenu links, they stay on one line rather than breaking to two.

I've tried display:block; on the links within the list. If I break the line in HTML the second link aligns to the right (no float:rights in the the code). The li's themselves have to be display:none rather than block elements so that they can be hidden until hovered. any ideas? here's my nav css



#mainnav a{
font-size:13px;
text-decoration:none;
padding:4px 12px 4px 12px;
display:block;
color:#FFF;
}



ul { /* all lists */
padding: 0;
margin: 0;
list-style: none;
background-color:#342d2d;

}

li { /* all list items */
float: left;
position: relative;


}

li ul { /* second-level lists */
display: none;
position: absolute;
top: 5px;
left: 0;
width:100%;
clear:both;

}


li>ul { /* to override top and left in browsers other than IE, which will position to the top right of the containing li, rather than bottom left */
top: auto;
left: auto;
}

li:hover ul, li.over ul { /* lists nested under hovered list items */
display: block;
}


#mainnav li li a {
font-size:11px;
float:left;
display:block;
}


#mainnav li li a:hover {
color:#FFFF00;
}

Lechlak
22 Jan 2010, 11:59 AM
IS it live online to view?