<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Responsive navbar</title>
</head>
<body>
<div class="top">
<div class="cen">
<ul>
<li><a href="#">Home</a></li>
<li><a href="#">About Me</a></li>
<li><a href="#">Services</a></li>
<li><a href="#">Blogs</a></li>
<li><a href="#">Contact</a></li>
</ul>
</div>
</div>
</body>
</html>
body
{
margin: 0;
padding: 0;
background: #f1f1f1;
font-family: sans-serif;
}
.top
{
width: 100%;
background: #313131;
overflow: hidden;
}
.cen
{
max-width: 1200px;
margin: auto;
}
.top ul
{
margin: 0;
padding: 0;
}
.top ul li
{
list-style: none;
display: inline-block;
}
.top ul li a
{
text-decoration: none;
color: #fff;
padding: 10px;
display: block;
font-size: 18px;
transition: 0.4s all;
}
.top ul li a:hover
{
font-size: 22px;
font-weight: 800;
}
@media screen and (max-width: 430px)
{
.top ul li
{
display: block;
}
.top ul li a
{
text-align: center;
}
}
This Pen doesn't use any external CSS resources.
This Pen doesn't use any external JavaScript resources.