Push menu para el diseño web moderno, construido usando HTML puro/CSS."> Push menu para el diseño web moderno, construido usando HTML puro/CSS.">

Solo el menú Push móvil de CSS

Tiempo de ejecución: 30 minutos. Empezar

Autor: kaiquezimerer
Views Total: 1,781
Sitio oficial: Ir a la web
Actualizado: September 4, 2017
Licencia: MIT

Vista prévia

Solo el menú Push móvil de CSS

Descripción

Un < a href = "https://wikicss.com/tag/push-menu/" > Push menu para el diseño web moderno, construido usando HTML puro/CSS.

Funcionamiento

Cree una navegación de cabecera horizontal normal para su página web.

<header class="header">

<nav>


<ul>



<li><a href="#">Link 1</a></li>



<li><a href="#">Link 2</a></li>



<li><a href="#">Link 3</a></li>



<li><a href="#">Link 4</a></li>



<li><a href="#">Link 5</a></li>


</ul>

</nav>
</header>

Cree los controles del menú móvil como estos:

<input type="checkbox" class="toggle-nav" id="toggle-nav">
<div class="mobile-bar">

<label for="toggle-nav"></label>
</div>

Los estilos primarios CSS/CSS3.

/** Mobile Bar **/

.toggle-nav {

display: none;
}

.mobile-bar {

z-index: 5;

position: relative;

width: 100%;

height: 60px;

background-color: #AB47BC;

-webkit-box-shadow: 0px 1px 5px rgba(0,0,0,0.3);

box-shadow: 0px 1px 5px rgba(0,0,0,0.3);
}

.mobile-bar label {

position: absolute;

top: 0;

left: 10px;

width: 60px;

height: 60px;

text-align: center;

cursor: pointer;

-webkit-transition: -webkit-transform 500ms ease;

transition: -webkit-transform 500ms ease;

transition: transform 500ms ease;

transition: transform 500ms ease, -webkit-transform 500ms ease;
}

.mobile-bar label:after {

content: "\2630";

font-size: 2em;

color: #eee;

line-height: 60px;

-webkit-backface-visibility: hidden;

backface-visibility: hidden;

-webkit-transition: color 500ms ease;

transition: color 500ms ease;
}

/** Slide-Out Effect **/

.toggle-nav:checked ~ .container { /** when the checkbox is checked the container slide-out **/

-webkit-transform: translateX(70%);

transform: translateX(70%);

-webkit-transform: translate3d(70%, 0, 0);

transform: translate3d(70%, 0, 0);
}

/** Label Effect (Menu Icon) **/

.toggle-nav:checked + .mobile-bar label {

-webkit-transform: rotate(180deg);

transform: rotate(180deg);
}

.toggle-nav:checked + .mobile-bar label:after {

color: black;
}

/** Container **/

.container {

position: relative;

-webkit-transition: -webkit-transform 500ms ease;

transition: -webkit-transform 500ms ease;

transition: transform 500ms ease;

transition: transform 500ms ease, -webkit-transform 500ms ease;
}

/** Header **/

.header {

position: absolute;

left: -70%;

width: 70%;

height: 100%;

background-color: #AB47BC;
}

.header ul {

font-size: 1.2em;

font-weight: 100;

text-align: center;

text-transform: uppercase;
}

.header a {

display: block;

padding: 15px;

border-bottom: 1px solid #eee;

color: #eee;

-webkit-transition: background-color 300ms;

transition: background-color 300ms;
}

.header a:active {

background-color: #9C27B0;
}

Convierta el menú horizontal en un menú Push apto para dispositivos móviles en una pantalla pequeña:

@media (min-width: 730px) {



.mobile-bar {


display: none;

}



.toggle-nav:checked ~ .container {


-webkit-transform: translateX(0);


transform: translateX(0);

}



.container {


-webkit-transition: none;


transition: none;

}



.header {


position: relative;


left: 0;


width: 100%;


height: auto;

}



.header ul {


font-size: 1.1em;

}



.header li,

.header a {


display: inline-block;

}



.header li {


margin-right: -6px; /** fix the inline-block margin gap **/

}



.header a {


padding: 10px 45px;


border-bottom: none;

}



.header a:hover {


background-color: #9C27B0;

}

}

 

Te puede interesar: