|
|
|
CSS Fly-out MenuIntroductionThis page demonstrates how a fly-out menu can be constructed by using pure CSS
techniques. The menu should work on most standards-compliant browsers. Naturally,
Internet Explorer 6 (IE6) likes to screw things up, so I used a little helper
[1] to get the menu functioning as it should. There are
various other pure CSS menu tricks on the web [2,
3, 4 and 5],
although some implementations don't work well in IE6 without relying on messy
HTML hacks [3]. I tried to avoid that as much as possible. Summary on How the Menu WorksThe fly-out menu is structured entirely out of unordered lists. Submenus are basically lists nested within a parent list. To give you an idea how a typical menu is structured, I have taken the CSS Menu Demo section from the main menu and reproduced it with the styling absent: As you can see, without styling the entire menu falls back to a bunch of plain,
boring unordered lists. The nested lists are highlighted by the green dashed boxes.
When the appropriate styling is applied, these nested lists (or more precisely
the submenus) become hidden by default. They are only revealed when the mouse cursor
hovers over a list item in the parent menu. The revealed submenus are displayed as
floating elements, which are offset by the parent menu's width. Other Unrelated Design IssuesI also wanted to make this page to have a two-column layout, with a banner (i.e.. header)
and a footer. Getting this layout to work in pure CSS turned out to be a bigger challenge
than I anticipated. I spent more time trying to get the page layout to work compared to
the time I spent making the menu! Eventually, I gave up and I cheated by using tables.
(An acquaintance of mine regarded this decision as blasphemy...) References[1] P. Nederlof, Whatever:hover, 2006. [2] P. Griffiths, D. Webb, Suckerfish Dropdowns, www.alistapart.com, 2003. [3] S. Nicholls, CSSplay - CSS Only Menus, cssplay.co.uk, 2006. [4] H. Bergevin, J. Gallant, All-CSS Flyout Nav, positioniseverything.net, 2005. [5] H. Bergevin, J. Gallant, Deluxe CSS Dropdowns and Flyouts, positioniseverything.net, 2005. [6] E. Costello, CSS Layout Techniques: for Fun and Profit, www.glish.com, 2004(?). [7] E. Costello, Introduction to CSS Layout, www.oreillynet.com, 2002. [8] R. Chandanais, The Layout Reservoir, bluerobot.com, 2002. Boring Copyright StuffThe menu specific CSS code and graphics is Copyright © 2006, Dominik Deak. You are welcome to use and modify this code in non-commercial projects only. :) |
|
|
Copyright © 2006, Dominik Deak
|
|