Adding Pull-Down Menus
You may have looked at the sliding menus in the previous task and said to yourself, that’s nice, but what I really want are those pull-down menus that make Web pages look like applications. Here’s the secret: there’s not a lot of difference between the previous task and this one. In fact, the HTML is identical (just refer back to Script 15.1); the CSS is in Script 15.4, and the JavaScript is in Script 15.5.
Script 15.4. A little more CSS and a little more JavaScript give your menus a more traditional look.
body { background-color: white; color: black; } div { margin-bottom: 10px; width: 20em; background-color: #9CF; } ul.menu { display: none; list-style-type: none; margin: 0; padding: 0; } ul.menu li { font: 1em arial, ... |
Get JavaScript and Ajax for the Web: Visual QuickStart Guide, Seventh Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.