Template:Caltech Menubar
From 2012.igem.org
(Difference between revisions)
Line 104: | Line 104: | ||
/************************************************************/ | /************************************************************/ | ||
- | + | /* BE SURE TO INCLUDE THE CSS RESET FOUND IN THE DEMO PAGE'S CSS */ | |
- | + | /*------------------------------------*\ | |
- | + | NAV | |
- | + | \*------------------------------------*/ | |
- | + | #nav{ | |
- | + | list-style:none; | |
- | + | margin-bottom:0px; | |
- | + | /* Clear floats */ | |
+ | float:center; | ||
- | + | font: arial, helvetica, sans-serif; | |
- | + | height: auto; | |
- | + | width: auto; | |
- | + | margin: 0; | |
- | + | border-top: 0; | |
- | + | border-right: 0; | |
- | + | border-left: 0; | |
+ | padding: 0; | ||
+ | background: black; | ||
+ | position:center; | ||
+ | */ | ||
} | } | ||
- | + | ul, li | |
- | + | { | |
- | + | margin:0; | |
- | + | padding:0; | |
+ | padding-top:5px; | ||
} | } | ||
- | #nav li { | + | #nav li{ |
- | + | float:left; | |
- | + | margin-right:0px; | |
+ | position:relative; | ||
+ | font: arial, helvetica, sans-serif; | ||
+ | text-align: left; | ||
+ | list-style-type: none; | ||
+ | border: 0; | ||
+ | padding: 10px; | ||
+ | background: black; | ||
} | } | ||
- | + | #nav a{ | |
- | #nav | + | display:inline-block; |
- | + | padding-below:12px; | |
- | + | background:#000000; | |
- | + | text-decoration:none; | |
- | + | ||
- | + | ||
} | } | ||
- | + | #nav a:hover{ | |
- | #nav | + | background:#000000; |
- | + | text-decoration:underline; | |
- | + | ||
} | } | ||
- | #nav | + | /*--- DROPDOWN ---*/ |
- | + | #nav ul{ | |
+ | background:#000000; /* Adding a background makes the dropdown work properly in IE7+. Make this as close to your page's background as possible (i.e. white page == white background). */ | ||
+ | background:rgba(255,255,255,0); /* But! Let's make the background fully transparent where we can, we don't actually want to see it if we can help it... */ | ||
+ | list-style:none; | ||
+ | position:absolute; | ||
+ | left:-9999px; /* Hide off-screen when not needed (this is more accessible than display:none;) */ | ||
} | } | ||
- | + | #nav ul li{ | |
- | #nav li | + | padding-top:0px; /* Introducing a padding between the li and the a give the illusion spaced items */ |
- | + | float:none; | |
- | + | ||
- | + | ||
} | } | ||
- | + | #nav ul a{ | |
- | #nav | + | white-space:nowrap; /* Stop text wrapping and creating multi-line dropdown items */ |
- | + | ||
- | + | ||
- | + | ||
} | } | ||
- | + | #nav li:hover ul{ /* Display the dropdown on hover */ | |
- | + | left:0; /* Bring back on-screen when needed */ | |
- | #nav li:hover ul | + | |
- | + | ||
} | } | ||
- | #nav li:hover | + | #nav li:hover a{ /* These create persistent hover states, meaning the top-most link stays 'hovered' even when your cursor has moved down the list. */ |
- | + | background:#000000; | |
+ | text-decoration:none; | ||
+ | } | ||
+ | #nav li:hover ul a{ /* The persistent hover state does however create a global style for links even before they're hovered. Here we undo these effects. */ | ||
+ | text-decoration:none; | ||
+ | } | ||
+ | #nav li:hover ul li a:hover{ /* Here is the background for hovering over each individual link. */ | ||
+ | background:#000000; | ||
} | } | ||
- | |||
</style> | </style> |
Revision as of 18:45, 14 September 2012