Responsive Menu
How do I make an responsive menu?
What is a responsive menu? How do you make a responsive menu? This script and codes were developed by Robin Brons on 16 September 2022, Friday.
Responsive Menu - Script Codes HTML Codes
<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>Responsive Menu</title> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/normalize/5.0.0/normalize.min.css"> <link rel='stylesheet prefetch' href='http://robinbrons.com/menu/css/fontello.css'> <style> /* NOTE: The styles were added inline because Prefixfree needs access to your styles and they must be inlined if they are on local disk! */ @import url(https://fonts.googleapis.com/css?family=Open+Sans:600,400);
html { font-family: 'Open Sans', sans-serif;
}
.wrap { margin: 20px auto;
}
#nav { width: 960px; background: hsl(0,0%,5%); font-weight: 600; font-size: 13px; border-radius: 5px;
}
#nav ul { margin: 0; padding: 0;
}
#nav ul li, label[for=toggle] { display: inline-block; cursor: pointer; color: hsl(0,0%,75%); padding: 13px 10px 13px 25px; text-transform: uppercase; letter-spacing: 1px;
}
#nav ul li:last-child { padding: 13px 25px 13px 25px;
}
#nav ul li:hover,
label[for=toggle]:hover { color: hsl(0,0%,90%); text-shadow: 0 0 1px #fff;
}
@media only screen
and (min-width : 1025px) { input[type=checkbox]#toggle, label[for=toggle] { display: none; }
}
@media only screen
and (max-width : 679px) { #nav { width: 80%; } input[type=checkbox]#toggle { position: absolute; z-index: -9999px; top: -9999px; left: -9999px; } i.icon-menu-1 { margin: 0 10px 0 0; } label[for=toggle] { width: 90%; } #menu { display: none; } input[type=checkbox]#toggle:checked ~ #menu { display: block; } input[type=checkbox]#toggle:checked ~ #menu li { display: block; }
}
@media only screen
and (min-width : 680px)
and (max-width : 702px) { #nav { width: 80%; font-size: 11px; } input[type=checkbox]#toggle, label[for=toggle] { display: none; }
}
@media only screen
and (min-width : 703px)
and (max-width : 728px) { #nav { width: 80%; font-size: 12px; } input[type=checkbox]#toggle, label[for=toggle] { display: none; }
}
@media only screen
and (min-width : 728px)
and (max-width : 1024px) { #nav { width: 80%; font-size: 13px; } input[type=checkbox]#toggle, label[for=toggle] { display: none; }
} </style> <script src="https://cdnjs.cloudflare.com/ajax/libs/prefixfree/1.0.7/prefixfree.min.js"></script>
</head>
<body> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <link href="//netdna.bootstrapcdn.com/font-awesome/3.2.1/css/font-awesome.css" rel="stylesheet">
</head>
<body> <nav id="nav" class="wrap"> <input type="checkbox" name="toggle" id="toggle" /> <label for="toggle"><i class="icon-reorder"></i>Menu</label> <ul id="menu"> <li>Home</li> <li>Portfolio</li> <li>Services</li> <li>Blog</li> <li>About</li> <li>Contact</li> </ul> </nav>
</body>
</body>
</html>
Responsive Menu - Script Codes CSS Codes
@import url(https://fonts.googleapis.com/css?family=Open+Sans:600,400);
html { font-family: 'Open Sans', sans-serif;
}
.wrap { margin: 20px auto;
}
#nav { width: 960px; background: hsl(0,0%,5%); font-weight: 600; font-size: 13px; border-radius: 5px;
}
#nav ul { margin: 0; padding: 0;
}
#nav ul li, label[for=toggle] { display: inline-block; cursor: pointer; color: hsl(0,0%,75%); padding: 13px 10px 13px 25px; text-transform: uppercase; letter-spacing: 1px;
}
#nav ul li:last-child { padding: 13px 25px 13px 25px;
}
#nav ul li:hover,
label[for=toggle]:hover { color: hsl(0,0%,90%); text-shadow: 0 0 1px #fff;
}
@media only screen
and (min-width : 1025px) { input[type=checkbox]#toggle, label[for=toggle] { display: none; }
}
@media only screen
and (max-width : 679px) { #nav { width: 80%; } input[type=checkbox]#toggle { position: absolute; z-index: -9999px; top: -9999px; left: -9999px; } i.icon-menu-1 { margin: 0 10px 0 0; } label[for=toggle] { width: 90%; } #menu { display: none; } input[type=checkbox]#toggle:checked ~ #menu { display: block; } input[type=checkbox]#toggle:checked ~ #menu li { display: block; }
}
@media only screen
and (min-width : 680px)
and (max-width : 702px) { #nav { width: 80%; font-size: 11px; } input[type=checkbox]#toggle, label[for=toggle] { display: none; }
}
@media only screen
and (min-width : 703px)
and (max-width : 728px) { #nav { width: 80%; font-size: 12px; } input[type=checkbox]#toggle, label[for=toggle] { display: none; }
}
@media only screen
and (min-width : 728px)
and (max-width : 1024px) { #nav { width: 80%; font-size: 13px; } input[type=checkbox]#toggle, label[for=toggle] { display: none; }
}
Developer | Robin Brons |
Username | bronsrobin |
Uploaded | September 16, 2022 |
Rating | 3.5 |
Size | 2,907 Kb |
Views | 16,192 |
Find the perfect freelance services for your business! Fiverr's mission is to change how the world works together. Fiverr connects businesses with freelancers offering digital services in 500+ categories. Find Developer!
Name | Size |
Doggie | 2,898 Kb |
Pure CSS Menu | 3,321 Kb |
Pure CSS Image Slider | 4,372 Kb |
Raaawr Dinosaur | 3,149 Kb |
Price Tags | 2,647 Kb |
Form Progress | 3,767 Kb |
Codepen.io Chrome Extension | 2,640 Kb |
Chrome Cast Loader | 2,590 Kb |
Responsive forum | 6,252 Kb |
Wordpress Calendar | 2,886 Kb |
Jasper is the AI Content Generator that helps you and your team break through creative blocks to create amazing, original content 10X faster. Discover all the ways the Jasper AI Content Platform can help streamline your creative workflows. Start For Free!
Name | Username | Size |
Drag n Drop | Martin42 | 2,594 Kb |
Spiralator 9000 | AdmiralPotato | 4,671 Kb |
Intake Form Page 2 | Ijantje | 4,983 Kb |
Minimal Material Design Form Input | Koenigsegg1 | 3,076 Kb |
Parallax scrolling scene | Iharosi | 2,485 Kb |
Pure CSS Torch Light | Juliendargelos | 2,727 Kb |
Update CSS Variables with JS | Wesbos | 2,335 Kb |
Headroom.js demo | WickyNilliams | 3,982 Kb |
Scrolling Horizontal Isotope | Bramus | 2,017 Kb |
Material design buttons | Fischaela | 4,381 Kb |
Surf anonymously, prevent hackers from acquiring your IP address, send anonymous email, and encrypt your Internet connection. High speed, ultra secure, and easy to use. Instant setup. Hide Your IP Now!