Son of Suckerfish Modification

While working on a new client site, I needed to modify the three-level son-of-suckerfish css rollover menu to display first and second levels initially and only show third level on rollover. The resulting barebones CSS is below. Needless to say, this is for a vertical list, not the default suckerfish horizontal one.

#nav, #nav ul { /* all lists */
	padding: 0;
	margin: 0;
	list-style: none;
	line-height: 1;
}

#nav a {
	display: block;
	width: 163px;
	padding: 4px 0 4px 10px;
}

#nav li { /* all list items */
	font-size: 18px;
	margin-bottom: 0px;
	float: left;
	width: 173px; /* width needed or else Opera goes nuts */
}

#nav li ul { /* second-level lists */
}

#nav li ul a, #nav li ul a:visited {
	font-size: 14px;
	padding-left: 20px;
	width: 153px;
}

#nav li ul ul { /* third-and-above-level lists */
	position: absolute;
	width: 190px;
	left: -999em; /* using left instead of display to hide menus because display: none isn't read by screen readers */
}

#nav li:hover ul ul, #nav li:hover ul ul ul, #nav li.sfhover ul ul, #nav li.sfhover ul ul ul {
	left: -999em;
}

#nav li ul ul a:hover {
	text-decoration: underline;
}

#nav li:hover ul, #nav li li:hover ul, #nav li li li:hover ul, #nav li.sfhover ul, #nav li li.sfhover ul, #nav li li li.sfhover ul { /* lists nested under hovered list items */
	left: auto;
}

Once the client’s new site is live, you’ll be able to get to it, and see this menu in action, via the portfolio.

posted Nov 23 2009