View comments | RSS feed

Spry

CSS code for the Menu Bar widget

The SpryMenuBarHorizontal.css and SpryMenuBarVertical.css files contain the rules that style the Menu Bar widget. You can edit these rules to style the menu bar’s look and feel. The names of the rules in the CSS file correspond directly to the names of the classes specified in the Menu Bar widget’s HTML code.

Note: You can replace style-related class names in the SpryMenuBarHorizontal.css and SpryMenuBarVertical.css files and HTML code with class names of your own. Doing so does not affect the functionality of the widget, as CSS code is not required for widget functionality.

The default functionality for the behaviors classes at the end of the style sheet are defined in the SpryMenuBar.js JavaScript library file. You can change the default functionality by adding properties and values to the behavior rules in the style sheet.

The following is the CSS code for the SpryMenuBarHorizontal.css file:

/*Menu Bar styling classes*/
ul.MenuBarHorizontal{
	margin: 0;
	padding: 0;
	list-style-type: none;
	font-size: 100%;
	cursor: default;
	width: auto;
}
ul.MenuBarActive{
	z-index: 1000;
}
ul.MenuBarHorizontal li{
	margin: 0;
	padding: 0;
	list-style-type: none;
	font-size: 100%;
	position: relative;
	text-align: left;
	cursor: pointer;
	width: 8em;
	float: left;
}
ul.MenuBarHorizontal ul{
	margin: 0;
	padding: 0;
	list-style-type: none;
	font-size: 100%;
	z-index: 1020;
	cursor: default;
	width: 8.2em;
	position: absolute;
	left: -1000em;
}
ul.MenuBarHorizontal ul.MenuBarSubmenuVisible{
	left: auto;
}
ul.MenuBarHorizontal ul li{
	width: 8.2em;
}
ul.MenuBarHorizontal ul ul{
	position: absolute;
	margin: -5% 0 0 95%;
}
ul.MenuBarHorizontal ul.MenuBarSubmenuVisible ul.MenuBarSubmenuVisible{
	left: auto;
	top: 0;
}
ul.MenuBarHorizontal ul{
	border: 1px solid #CCC;
}
ul.MenuBarHorizontal a{
	display: block;
	cursor: pointer;
	background-color: #EEE;
	padding: 0.5em 0.75em;
	color: #333;
	text-decoration: none;
}
ul.MenuBarHorizontal a:hover, ul.MenuBarHorizontal a:focus{
	background-color: #33C;
	color: #FFF;
}
ul.MenuBarHorizontal a.MenuBarItemHover, ul.MenuBarHorizontal a.MenuBarItemSubmenuHover, ul.MenuBarHorizontal a.MenuBarSubmenuVisible{
	background-color: #33C;
	color: #FFF;
}
ul.MenuBarHorizontal a.MenuBarItemSubmenu{
	background-image: url(SpryMenuBarDown.gif);
	background-repeat: no-repeat;
	background-position: 95% 50%;
}
ul.MenuBarHorizontal ul a.MenuBarItemSubmenu{
	background-image: url(SpryMenuBarRight.gif);
	background-repeat: no-repeat;
	background-position: 95% 50%;
}
ul.MenuBarHorizontal a.MenuBarItemSubmenuHover{
	background-image: url(SpryMenuBarDownHover.gif);
	background-repeat: no-repeat;
	background-position: 95% 50%;
}
ul.MenuBarHorizontal ul a.MenuBarItemSubmenuHover{
	background-image: url(SpryMenuBarRightHover.gif);
	background-repeat: no-repeat;
	background-position: 95% 50%;
}
ul.MenuBarHorizontal iframe{
	position: absolute;
	z-index: 1010;
}
@media screen, projection{
	ul.MenuBarHorizontal li.MenuBarItemIE{
		display: inline;
		f\loat: left;
		background: #FFF;
	}
}

The SpryMenuBar.css file contains extensive comments, explaining the code and the purpose for certain rules. For further information, see the comments in the file.




Comments


Art in MT said on Sep 11, 2009 at 9:00 AM :
I am trying to debug a problem with a spry menu that occures on just some machines. Trolling through code I noticed the line

f\loat : left;

in the SpryMenuBar.css file - both as installed on my system and on this site (above on this page, 4th line from the bottom)

I can find no reference to any command related to f\loat:

Can I assume this is a typo in the file that has no effect on the functioning of the CSS? Should it be changed to "float"?
ancil said on Sep 13, 2009 at 2:30 PM :
The positioning of the submenus works fine in Firefox on a Mac but not at all well for IE on a PC machine. The menus drop down way to the right on a PC and when I try to correct that, then they drop down way to the left on a Mac.

What is a fix for this?
jonmichael said on Sep 28, 2009 at 4:58 PM :
The f\loat is intentional. Using backslashes was a popular hack for hiding specific properties from certain versions of IE, specifically IE5 and IE5 on Mac. The person who wrote the Menu Bar code was trying to get the widget to work on as many versions of IE as he could.

Do a net-search on "IE Backslash Hacks" for more info.
jonmichael said on Sep 28, 2009 at 5:00 PM :
For questions about rendering issues in IE, I suggest you post to the Spry forum:

http://www.adobe.com/go/labs_spry_pr1_forum

Someone should definitely be able to help you there.

 

RSS feed | Send me an e-mail when comments are added to this page | Comment Report

Current page: http://livedocs.adobe.com/en_US/Spry/SDG/WS4E5B02D6-9A2B-4ecc-9FE5-8EE096749CDC.html