Responsive Navigation with HTML/CSS

Language
For the mark-up, create file and name it index.html. CSS only Demo Responsive Now we come to css, create a file and name it main.css. #container { display: block; width: 100%; margin: 1.09123432523124534% auto; } header{ display: block; padding-bottom: 50px; } ul { list-style-type: none; margin: 0; padding: 0; position: absolute; } li { display: inline-block; float: left; margin-right: 0.0625em; } li a { display: block; min-width: 8.75em; height: 3.125em; text-align: center; line-height: 3.125em; font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; color: #fff; background: #2f3036; text-decoration: none; } li:hover a { background: #19c589; } li:hover ul a { background: #f3f3f3; color: #2f3036; height: 2.5em; line-height: 2.5em; } li:hover ul a:hover { background: #19c589; color: #fff; } li ul { display: none; } li ul li { display: block; float: none; } li ul li a { width: auto; min-width: 6.25em; padding: 0 1.25em; } ul li a:hover + .hidden, .hidden:hover { display: block; } .show-menu { font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; text-decoration: none; color: #fff; background: #19c589; text-align: center; padding: 0.625em; display: none; } input[type=checkbox]{ display: none; } input[type=checkbox]:checked~#menu { display: block; } For responsiveness create another css file and name it responsive.css or you can just copy this code to main.css. @media screen and (max-width:768px){ header{ padding-bottom: 0; } ul { position: static; display: none; } li { margin-bottom: 0.0625em; } ul li, li a { width: 100%; } .show-menu { display: block; } }

Note: Due to the size or complexity of this submission, the author has submitted it as a .zip file to shorten your download time. After downloading it, you will need a program like Winzip to decompress it.

Virus note: All files are scanned once-a-day by SourceCodester.com for viruses, but new viruses come out every day, so no prevention program can catch 100% of them.

FOR YOUR OWN SAFETY, PLEASE:

1. Re-scan downloaded files using your personal virus checker before using it.
2. NEVER, EVER run compiled files (.exe's, .ocx's, .dll's etc.)--only run source code.

Add new comment