Responsive Navigation With Flexbox

Developer
Size
2,781 Kb
Views
44,528

How do I make an responsive navigation with flexbox?

Experimenting with responsive navigation using Flexbox. . What is a responsive navigation with flexbox? How do you make a responsive navigation with flexbox? This script and codes were developed by Alex Loomer on 08 September 2022, Thursday.

Responsive Navigation With Flexbox Previews

Responsive Navigation With Flexbox - Script Codes HTML Codes

<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>Responsive Navigation With Flexbox</title> <meta name="viewport" content="width=device-width, initial-scale=1"> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/normalize/5.0.0/normalize.min.css"> <link rel="stylesheet" href="css/style.css">
</head>
<body> <div class="bar"> <nav id="desktop"> <ul> <li><a href="#">Home</a></li> <li><a href="#">About</a></li> <li><a href="#">Services</a></li> <li><a href="#">Contact</a></li> </ul> </nav>
</div>
<div id="burg"> <a href="#"><span class="bar" id="top"></span> <span class="bar" id="middle"></span> <span class="bar" id="bottom"></span></a>
</div>
<div class="mobile-tab"> <nav id="mobile"> <ul> <li><a href="#">Home</a></li> <li><a href="#">About</a></li> <li><a href="#">Services</a></li> <li><a href="#">Contact</a></li> </ul> </nav>
</div>
<div id="page"> <h1>Flexbox Navigation</h1> <p id="break">_____________________________________________________________________________________________________________________________________</p> <p>An experimental project using Flexbox to create responsive navigation. </br> Feel free to use as you'd like.</p>
</div> <script src='https://cdnjs.cloudflare.com/ajax/libs/jquery/2.2.2/jquery.min.js'></script>
<script src='https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.11.4/jquery-ui.min.js'></script> <script src="js/index.js"></script>
</body>
</html>

Responsive Navigation With Flexbox - Script Codes CSS Codes

/* BODY STYLING */
body { background: #333;
}
#page { height: 75vh; background: #333; display: -webkit-box; display: -ms-flexbox; display: flex; -webkit-box-pack: center; -ms-flex-pack: center; justify-content: center; -webkit-box-orient: vertical; -webkit-box-direction: normal; -ms-flex-direction: column; flex-direction: column;
}
h1 { text-align: center; margin: 0; display: -webkit-box; display: -ms-flexbox; display: flex; -webkit-box-pack: center; -ms-flex-pack: center; justify-content: center; color: white; font-weight: lighter; letter-spacing: 2px; -webkit-box-align: center; -ms-flex-align: center; align-items: center;
}
p { display: -webkit-box; display: -ms-flexbox; display: flex; -webkit-box-pack: center; -ms-flex-pack: center; justify-content: center; color: white; font-weight: lighter; -webkit-box-align: center; -ms-flex-align: center; align-items: center; text-align: center; line-height: 1.5em; color: #C3C3C3;
}
#break { font-size: 5px; color: #70B970;
}
/* STYLES FOR MOBILE */
#burg a { display: block; width: 70px;
}
#burg { width: 98%; background: #232323; padding: 7.5px 0 7.5px 2%;
}
span { display: -webkit-box; display: -ms-flexbox; display: flex; margin: 8px; width: 30px; height: 1px; background: #C3C3C3; z-index: 999;
}
.mobile-tab { display: -webkit-box; display: -ms-flexbox; display: flex; width: 100%; background: #232323; -webkit-box-orient: vertical; -webkit-box-direction: normal; -ms-flex-direction: column; flex-direction: column;
}
#desktop { display: none;
}
.mobile-tab a { font-size: 1.3em; color: #C3C3C3; text-decoration: none; font-weight: lighter; letter-spacing: 1px;
}
.mobile-tab li { list-style-type: none; margin: 5% 5%;
}
.mobile-tab ul { padding: 5% 0;
}
/* STYLES FOR DESKTOP */
@media screen and (min-width: 768px) { .mobile-tab, #burg, #mobile { display: none; } .bar { background: #232323; display: -webkit-box; display: -ms-flexbox; display: flex; width: 100%; -webkit-box-align: center; -ms-flex-align: center; align-items: center; -webkit-box-pack: end; -ms-flex-pack: end; justify-content: flex-end; } .mobile-bar { display: none; } #desktop { display: -webkit-box; display: -ms-flexbox; display: flex; } a { text-decoration: none; color: #C3C3C3; margin: 0; } ul { display: -webkit-inline-box; display: -ms-inline-flexbox; display: inline-flex; list-style-type: none; padding: 0; margin: 0; } li { color: white; cursor: pointer; font-weight: lighter; background: #232323; padding: 20px 20px; text-align: center; width: 70px; letter-spacing: 1px; -webkit-transition: all .2s ease-in-out; transition: all .2s ease-in-out; } li:hover { background: #fff; opacity: .8; box-shadow: inset 1px 1px 5px gray; } li:hover a { color: #2B2B2B; }
}

Responsive Navigation With Flexbox - Script Codes JS Codes

// HIDE MOBILE NAV ON PAGE LOAD
$('.mobile-tab').hide();
// TOGGLE MENU ON AND OFF
$('#burg').on('click', function() { $('.mobile-tab').slideToggle(280);
});
Responsive Navigation With Flexbox - Script Codes
Responsive Navigation With Flexbox - Script Codes
Home Page Home
Developer Alex Loomer
Username atloomer
Uploaded September 08, 2022
Rating 3
Size 2,781 Kb
Views 44,528
Do you need developer help for Responsive Navigation With Flexbox?

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!

Alex Loomer (atloomer) Script Codes
Create amazing art & images with AI!

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!