Skip to content

Instantly share code, notes, and snippets.

@alexmoise
Created November 20, 2017 14:44
Show Gist options
  • Save alexmoise/452e27ef319e6e54d4de43706987677e to your computer and use it in GitHub Desktop.
Save alexmoise/452e27ef319e6e54d4de43706987677e to your computer and use it in GitHub Desktop.
SIMPLEST CSS STYLES TO TURN A REGULAR ul > li MENU INTO A RESPONSIVE DROP DOWN, while keeping the first item displayed as the first option, with a right & down switching triangle indicator after it. Just add #menu-container to the container div or whatever or change the ID selector below to match an existing one.
/* SIMPLEST CSS STYLES TO TURN */
/* A REGULAR ul > li MENU INTO A */
/* RESPONSIVE DROP DOWN, */
/* while keeping the first item */
/* displayed as the first option, */
/* with a right & down switching */
/* triangle indicator after it. */
/* === */
/* Just add #menu-container to */
/* the container div or whatever */
/* or change the ID selector */
/* below to match an existing one */
#menu-container ul li {
width: 100%;
padding: 6px 0;
}
#menu-container ul:hover li {
display: block !important;
}
#menu-container ul li:not(:first-child) {
display: none;
}
#menu-container ul li:first-child:after {
content: '\25b6';
color: white;
line-height: 20px;
}
#menu-container ul:hover li:first-child:after {
content: '\25bc';
font-size: 10px;
line-height: 20px;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment