Toggle navigation
Bootsnipp
Bootstrap
For
CSS Frameworks
Bootstrap
Foundation
Semantic UI
Materialize
Pure
Bulma
References
CSS Reference
Tools
Community
Page Builder
Form Builder
Button Builder
Icon Search
Dan's Tools
Diff / Merge
Color Picker
Keyword Tool
Web Fonts
.htaccess Generator
Favicon Generator
Site Speed Test
Snippets
Featured
Tags
By Bootstrap Version
4.1.1
4.0.0
3.3.0
3.2.0
3.1.0
3.0.3
3.0.1
3.0.0
2.3.2
Register
Login
"CSS Only Mobile Menu- check on desktop- media query doesn't work here"
Bootstrap 3.0.0 Snippet by
jeevan123456
3.0.0
menu
Preview
HTML
CSS
View Full Screen
Fork
Fork this
2.4K
 
0 Fav
Post to Facebook
Tweet this
<link href="//netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap.min.css" rel="stylesheet" id="bootstrap-css"> <script src="//netdna.bootstrapcdn.com/bootstrap/3.0.0/js/bootstrap.min.js"></script> <script src="//code.jquery.com/jquery-1.11.1.min.js"></script> <!------ Include the above in your HEAD tag ----------> <header class="header"> <a href="#" class="logo"> <h1>Logo</h1> </a> <input type="checkbox" class="mobile-menu fa fa-bars" /> <nav id="nav" class="nav"> <ul class="nav__list"> <li class="nav__item"><a href="#" class="nav__link">Link</a></li> <li class="nav__item"><a href="#" class="nav__link">Link</a></li> <li class="nav__item"><a href="#" class="nav__link">Link</a></li> <li class="nav__item"><a href="#" class="nav__link">Link</a></li> </ul> </nav> </header>
.header { align-items: center; background: #CCC; display: flex; font-family: sans-serif; height: 60px; justify-content: space-between; padding: 0 15px; } .logo { color: #333; font-size: 24px; text-decoration: none; } .mobile-menu { align-items: center; display: flex; justify-content: flex-end; visibility: hidden; &:before { color: #333; display: block; font-size: 27px; visibility: visible; } // For this, what you target is up to you, but I went with an ID in case you have multiple nav classes. &:checked ~ #nav { right: 0; } @media(min-width: 768px) { display: none; } } .nav { @media(max-width: 767px) { background: #EEE; height: 100vh; position: fixed; right: -250px; top: 60px; transition: right 0.25s; width: 250px; } &__list { @media(min-width: 768px) { display: flex; } } &__item { @media(max-width: 767px) { border-bottom: 1px solid #333; } @media(min-width: 768px) { margin-left: 30px; &:first-child { margin-left: 0; } } } &__link { color: #333; text-decoration: none; @media(max-width: 767px) { display: block; padding: 15px 10px; } } }
Questions / Comments:
Post
Posting Guidelines
Formatting
- Now
×
Close
Donate
BTC: 12JxYMYi6Vt3mx3hcmP3B2oyFiCSF3FhYT
ETH: 0xCD715b2E3549c54A40e6ecAaFeB82138148a6c76