Skip to content

Instantly share code, notes, and snippets.

@scizzorz
Created March 1, 2018 22:12
Show Gist options
  • Save scizzorz/7fc2bcdd1b42727e5af58a3895ccbe5d to your computer and use it in GitHub Desktop.
Save scizzorz/7fc2bcdd1b42727e5af58a3895ccbe5d to your computer and use it in GitHub Desktop.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Title</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/normalize/8.0.0/normalize.min.css">
<link rel="stylesheet" href="main.css">
</head>
<body>
<nav>
<ul>
<li><a href="#">Menu 1</a></li>
<li><a href="#">Menu 2</a></li>
<li>
<span>Menu 3</span>
<ul>
<li><a href="#">This is a long submenu item 3.1</a></li>
<li><a href="#">Menu 3.2</a></li>
<li><a href="#">Menu 3.3</a></li>
</ul>
</li>
</ul>
</nav>
</body>
</html>
html {
font-size: 12pt;
color: #333;
background-color: #FCFCFC;
}
/* Layout */
nav {
user-select: none;
}
nav {
position: absolute;
left: 1rem;
top: 1rem;
right: 1rem;
height: 3rem;
border: 1px solid #222;
z-index: 83;
}
nav > ul {
list-style: none;
margin: 0;
padding: 0;
}
nav > ul > li {
position: relative;
float: left;
}
nav > ul span,
nav > ul a {
display: inline-block;
font-weight: bold;
margin: 0;
padding: 1rem;
text-decoration: none;
}
nav > ul > li > ul {
/*
display: none;
*/
padding: 0;
list-style: none;
position: absolute;
top: 100%;
left: 0;
border-color: #1A1A1A;
border-style: solid;
border-width: 0 1px 1px 1px;
}
nav > ul > li:hover > ul {
display: block;
}
nav > ul > li > ul > li {
background-color: #FAFAFA;
float: left;
}
nav > ul > li:hover {
background-color: #ECECEC;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment