Created
February 20, 2021 11:14
-
-
Save Pageboy/853b48152c001edea2095c7032d029c4 to your computer and use it in GitHub Desktop.
Responsive menu bar
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Responsive menu bar | |
*/ | |
html { | |
font-size: 16px; | |
} | |
* { | |
margin:0; | |
padding:0; | |
box-sizing: border-box; | |
} | |
body { | |
font-family: verdana; | |
} | |
h1 { | |
font-size: .9rem; | |
color: black; | |
position: fixed; | |
top:1rem; | |
left:6px; | |
} | |
nav ul { | |
list-style-type: none; | |
/* background-color: gray; */ | |
display:flex; | |
flex-direction: column; | |
align-items: flex-end; | |
} | |
nav ul li a { | |
text-decoration: none; | |
padding: .8rem 1rem; | |
display: block; | |
color:rgb(98, 40, 85); | |
text-align: center; | |
} | |
nav ul li { | |
position:relative; | |
flex: 0 1 auto; | |
width: 85px; | |
} | |
nav ul li:hover { | |
background-color: silver; | |
color:white; | |
} | |
nav ul li a:hover { | |
color:white; | |
/* border-bottom: 2px solid rgb(255, 11, 172); */ | |
/* padding-bottom: -2px; */ | |
} | |
nav ul li ul li a { | |
margin-left: 1rem; | |
} | |
nav ul li ul { | |
display:none; | |
width:100%; | |
} | |
nav ul li:hover ul { | |
display:flex; | |
flex-direction: column; | |
align-items: center; | |
} | |
@media screen and (min-width: 700px) { | |
nav ul { | |
flex-direction: row; | |
justify-content:flex-end; | |
} | |
nav ul li ul { | |
position:absolute; | |
} | |
nav ul li ul li a { | |
margin-left: 0; | |
} | |
} | |
@media screen and (max-width: 700px) { | |
nav ul li a { | |
text-align: left; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<h1>A Midsummer Nights's Dream</h1> | |
<nav> | |
<ul> | |
<li><a href="#">Home</a></li> | |
<li><a href="#">Info</a></li> | |
<li><a href="#">About</a> | |
<ul> | |
<li><a href="#">One</a></li> | |
<li><a href="#">Two</a></li> | |
<li><a href="#">three</a></li> | |
</ul> | |
</li> | |
<li><a href="#">News</a></li> | |
<li><a href="#">Contact</a></li> | |
</ul> | |
</nav> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// alert('Hello world!'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{"view":"separate","fontsize":"100","seethrough":"","prefixfree":"","page":"all"} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment