Skip to content

Instantly share code, notes, and snippets.

@tilomitra
Created September 26, 2013 23:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tilomitra/6722259 to your computer and use it in GitHub Desktop.
Save tilomitra/6722259 to your computer and use it in GitHub Desktop.
This gist makes Pure Menus easier to customize, and adds a new responsive menu that collapses. Check out this pull request for details: https://github.com/yui/pure/pull/142 This is BETA!
/*!
Pure 0.3.0
Copyright 2013 Yahoo! Inc. All rights reserved.
Licensed under the BSD License.
https://github.com/yui/pure/blob/master/LICENSE.md
*/
/*csslint adjoining-classes: false, box-model:false*/
.pure-menu ul, .pure-menu li {
position: relative;
}
.pure-menu ul {
list-style: none;
margin: 0;
padding: 0;
}
.pure-menu li {
padding: 0;
margin: 0;
height: 100%;
}
.pure-menu a,
.pure-menu .pure-menu-heading {
display: block;
line-height: 1.5em;
padding: 5px 20px;
text-decoration: none;
white-space: nowrap;
}
.pure-menu.pure-menu-horizontal > .pure-menu-heading {
display: inline-block;
*display: inline;
zoom: 1;
margin: 0;
vertical-align: middle;
}
.pure-menu-horizontal > ul {
display: inline-block;
*display: inline;
zoom: 1;
vertical-align: middle;
}
.pure-menu li a { padding: 5px 20px; }
.pure-menu-can-have-children > .pure-menu-label {
padding-right: 30px;
}
/* FIXED MENU */
.pure-menu-fixed {
position: fixed;
top: 0;
left: 0;
width: 100%;
}
/* HORIZONTAL MENU */
.pure-menu-horizontal {
width: 100%;
border-left: none;
border-right: none;
}
/* Initial menus should be inline-block so that they are horizontal */
.pure-menu-horizontal li {
display: inline-block;
*display: inline;
zoom: 1;
vertical-align: middle;
}
/* Submenus should still be display: block; */
.pure-menu-horizontal li li {
display: block;
}
/* Adjusting separator for vertical menus */
.pure-menu-horizontal .pure-menu-separator {
height: 50%;
width: 1px;
margin: 0 7px;
}
/* Submenus should be horizontal separator again */
.pure-menu-horizontal li .pure-menu-separator {
height: 1px;
width: auto;
margin: 7px 2px;
}
/* RESPONSIVE MENUS */
/* Hide the toggle button by default. It will show on small screen sizes */
.pure-menu-responsive .pure-menu-toggle {
float: right;
text-transform: uppercase;
font-size: 80%;
display: none;
}
/* If the menu is open, and the viewport is larger than 767px, we
still want the toggle button to show.
*/
.pure-menu-responsive.pure-menu-active .pure-menu-toggle {
display: block;
}
.pure-menu-responsive .pure-menu-toggle:after {
content: "\25BE";
float: right;
/* These specific fonts have the Unicode char we need. */
font-family: 'Lucida Grande', 'Lucida Sans Unicode', 'DejaVu Sans', sans-serif;
margin-right: -15px;
margin-top: -1px;
}
.pure-menu-responsive.pure-menu-active ul, .pure-menu-responsive.pure-menu-active li {
display: block;
}
.pure-menu-responsive.pure-menu-active .pure-menu-separator {
width: auto;
height: 1px;
}
/*csslint adjoining-classes: false, duplicate-properties:false*/
/* MENUS STYLING */
/* Focus style for a dropdown menu-item when the parent has been opened */
.pure-menu {
background: #fff; /* need this to make menus stand out from page background */
border: 1px solid #eee;
}
.pure-menu a {
color: #666;
}
/* Hover and focus styles */
.pure-menu li a:hover,
.pure-menu li a:focus {
background: #dedede;
*background: #dedede;
background: rgba(0,0,0,0.15);
}
/* DISABLED STATES */
/* need the .pure-menu prefix so that people over-riding `a` don't over-ride pure-menu-disabled too */
.pure-menu .pure-menu-disabled a,
.pure-menu .pure-menu-disabled a:hover,
.pure-menu .pure-menu-disabled a:focus {
color: #bababa;
*color: #bababa;
color: rgba(0,0,0, 0.5);
background: transparent;
}
.pure-menu-heading {
color: #565d64;
text-transform: uppercase;
font-size: 90%;
margin-top: 0.5em;
border-bottom: 1px solid #eee;
}
.pure-menu-horizontal .pure-menu-heading {
border-bottom: none;
}
/* ACTIVE MENU ITEM */
.pure-menu .pure-menu-selected a {
color: #000;
}
/* FIXED MENU */
.pure-menu-fixed {
border: none;
border-bottom: 1px solid #b7b7b7;
*border-bottom: 1px solid #b7b7b7;
border-bottom: 1px solid rgba(0,0,0,0.4);
}
/*csslint box-model:false*/
/*TODO: Remove this lint rule override after a refactor of this code.*/
.pure-paginator {
/* `pure-g` Grid styles */
letter-spacing: -0.31em; /* Webkit: collapse white-space between units */
*letter-spacing: normal; /* reset IE < 8 */
*word-spacing: -0.43em; /* IE < 8: collapse white-space between units */
text-rendering: optimizespeed; /* Webkit: fixes text-rendering: optimizeLegibility */
/* `pure-paginator` Specific styles */
list-style: none;
margin: 0;
padding: 0;
}
.opera-only :-o-prefocus,
.pure-paginator {
word-spacing: -0.43em;
}
/* `pure-u` Grid styles */
.pure-paginator li {
display: inline-block;
*display: inline; /* IE < 8: fake inline-block */
zoom: 1;
letter-spacing: normal;
word-spacing: normal;
vertical-align: top;
text-rendering: auto;
}
.pure-paginator .pure-button {
border-radius: 0;
padding: 0.8em 1.4em;
vertical-align: top;
height: 1.1em;
}
.pure-paginator .pure-button:focus,
.pure-paginator .pure-button:active {
outline-style: none;
}
.pure-paginator .prev,
.pure-paginator .next {
color: #C0C1C3;
text-shadow: 0 -1px 0 rgba(0,0,0, 0.45);
}
.pure-paginator .prev {
border-radius: 2px 0 0 2px;
}
.pure-paginator .next {
border-radius: 0 2px 2px 0;
}
/*adjoining-classes: false*/
@media (max-width: 767px) {
.pure-menu-responsive .pure-menu-toggle {
display: block;
}
.pure-menu-responsive ul {
display: none;
}
.pure-menu-responsive.pure-menu.active ul {
display: inline-block;
*display: inline;
zoom: 1;
vertical-align: middle;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment