13 diciembre, 2020
Comparativas de un menu de navegación responsivo entre TailwindCSS, Bootstrap y CSS puro, haremos ejemplos prácticos que muestren las diferencias
Suscríbete a nuestro canal en Youtube
SuscríbirseComparativas de un menu de navegación responsivo entre TailwindCSS, Bootstrap y CSS puro, haremos ejemplos prácticos que muestren las diferencias
<!-- Tailwind-css CDN -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/tailwindcss/1.4.6/tailwind.min.css" />
<nav class="bg-indigo-700 shadow-lg">
<div class="container mx-auto">
<div class="sm:flex justify-around">
<a href="#" class="text-white text-3xl font-bold p-3">CODEA APP</a>
<ul class="text-gray-400 sm:self-center text-xl border-t sm:border-none">
<li class="sm:inline-block">
<a href="#" class="p-3 hover:text-white">Menu 1</a>
</li>
<li class="sm:inline-block">
<a href="#" class="p-3 hover:text-white">Menu 2</a>
</li>
<li class="sm:inline-block">
<a href="#" class="p-3 hover:text-white">Menu 3</a>
</li>
<li class="sm:inline-block">
<a href="#" class="p-3 hover:text-white">Menu 4</a>
</li>
<li class="sm:inline-block">
<a href="#" class="p-3 hover:text-white">Menu 5</a>
</li>
</ul>
</div>
</div>
</nav>
<nav class="navbar navbar-expand-lg navbar-light bg-light">
<div class="container-fluid">
<a class="navbar-brand" href="#">Navbar</a>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarNav">
<ul class="navbar-nav">
<li class="nav-item">
<a class="nav-link active" aria-current="page" href="#">Home</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">Features</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">Pricing</a>
</li>
<li class="nav-item">
<a class="nav-link disabled" href="#" tabindex="-1" aria-disabled="true">Disabled</a>
</li>
</ul>
</div>
</div>
</nav>
<!DOCTYPE html>
<html lang="es">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>MENU RESPONSIVE</title>
</head>
<body>
<header class="menu">
<div class="menu-wrap">
<img src="logo.png" class="logo-img" alt="Logo">
<input type="checkbox" id="checkbox">
<nav>
<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>
<label for="checkbox">
<span class="menu-icon">M</span>
</label>
</div>
</header>
<style>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
font-family: sans-serif;
}
header {
height: 70px;
background-color: #22292F;
padding: 10px 0;
}
.menu-wrap {
display: flex;
justify-content: space-between;
padding: 0 15px;
}
.logo-img {
height: 50px;
}
.menu-icon {
font-size: 2.4em;
color: #ffffff;
line-height: 50px;
}
nav {
position: absolute;
background-color: #3D4852;
top:70px;
left:0;
width: 100%;
}
nav ul {
list-style-type: none;
max-height: 0px;
overflow: hidden;
transition: all 0.5s;
}
nav ul li {
padding: 0 15px;
}
nav ul li a {
display: inline-block;
padding: 12px;
/* Add your custom styles below to change appearance of links */
color: #DAE1E7;
text-decoration: none;
letter-spacing: 0.05em;
}
nav ul li a:hover, nav ul li a:focus {
color: #eb6f4a;
}
#checkbox {
display: none;
}
#checkbox:checked ~ nav ul {
max-height: 200px;
padding: 15px 0;
transition: all 0.5s;
}
@media (min-width: 768px) {
.menu-icon {
display: none;
}
nav {
position: relative;
top: -10px;
background-color: transparent;
}
nav ul {
max-height: 70px;
padding: 15px 0;
text-align: right;
}
nav ul li {
display: inline-flex;
padding-left: 20px;
}
}
</style>
</body>
</html>
Leido 7010 veces
Curso de Diseño de una Página Web en HTML & CSS
Descarga del código fuente
USD 0.00
© Copyright Codea App | LATAM | 2020 - 2024