Foros del Web » Creando para Internet » CSS »

Estilo CSS no funciona correctamente en Google Chrome, Opera y Safari

Estas en el tema de Estilo CSS no funciona correctamente en Google Chrome, Opera y Safari en el foro de CSS en Foros del Web. Buenas tardes. El problema es al escalar el navegador. La página tiene menú horizontal. Cuando paso a 768px aparece un botón que al pinchar se ...
  #1 (permalink)  
Antiguo 01/09/2015, 09:42
 
Fecha de Ingreso: octubre-2008
Mensajes: 9
Antigüedad: 15 años, 6 meses
Puntos: 0
Estilo CSS no funciona correctamente en Google Chrome, Opera y Safari

Buenas tardes.
El problema es al escalar el navegador. La página tiene menú horizontal. Cuando paso a 768px aparece un botón que al pinchar se abre el menú vertical, pero luego escalo a más de 768px y el botón desaparece y aparece el menú horizontal inicial sólo en Mozilla e IE, pero en Chrome, Opera y Safari el menú sigue vertical. Para ver el menú horizontal tengo que pulsar F5. Alguna sugerencia para solucionarlo? Gracias por vuestra ayuda.
Saludos.

HTML:

<!doctype html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Clínica</title>
<link rel="stylesheet" type="text/css" href="style.css">

</head>

<body>
<header>

<a href="index.html" id="logo">
<p class="logo-celtadent">CeltaDent</p>
<p class="logo-clinica-dental">Clínica</p>
</a>

<nav id="menu">
<a href="#" class="nav-mobile" id="nav-mobile"></a>
<ul>
<a href="#">
<li>
<img class="icono" src="icon1.png">
<p class="texto">Inicio</p>
</li>
</a>

<a href="#">
<li>
<img class="icono" src="icon2.png">
<p class="texto">Tratamientos</p>
</li>
</a>

<a href="#">
<li>
<img class="icono" src="icon3.png">
<p class="texto">Prótesis</p>
</li>
</a>

<a href="#">
<li>
<img class="icono" src="icon4.png">
<p class="texto">Ortodoncia</p>
</li>
</a>

<a href="#">
<li>
<img class="icono" src="icon5.png">
<p class="texto">Preguntas</p>
</li>
</a>

<a href="#">
<li>
<img class="icono" src="icon6.png">
<p class="texto">Consejos</p>
</li>
</a>

<a href="#">
<li>
<img class="icono" src="icon7.png">
<p class="texto">Contacto</p>
</li>
</a>

</ul>
</nav>

</header>

<div id="content">
<h2>Clínica</h2>

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script>
$(function() {

var btn_movil = $('#nav-mobile'),
menu = $('#menu').find('ul');

btn_movil.on('click', function (e) {
e.preventDefault();

var el = $(this);

el.toggleClass('nav-active');
menu.toggleClass('open-menu');
})

});
</script>

</div>
</body>
</html>



CSS

*{
margin: 0;
padding: 0;
}
body{
background: #FFF;
font: bold 1.0em 'Tahoma','Open Sans Condensed','Arial Narrow', serif;
}
header, nav{
display: block;
}

header{
background: rgba(255, 135, 15, 0.8);
height: 110px;
position: relative;
width: 100%;
z-index: 2
}

a{
text-decoration: none;
}

#logo{
display: block;
float: left;
margin: 6px 6px 0;
height: 110px;
}

#menu{float: right;}

#menu ul{
list-style: none;
font-size: 0.82em;
overflow: hidden;
}


#menu li{
display: block;
float: left;
text-align: center;
width: 90px;
height: 110px;
webkit-transition: height 0.4s;
-moz-transition: height 0.4s;
-o-transition: height 0.4s;
transition: height 0.4s;

}


#menu li p.texto{
-webkit-transition: padding-top 0.4s;
-moz-transition: padding-top 0.4s;
-o-transition: padding-top 0.4s;
transition: padding-top 0.4s;
}

#menu li:hover p.texto{
padding-top: 10px;
opacity: 1;
}

#menu li:hover img.icono{
box-shadow: 0px 0px 0px 0px rgba(0, 204, 0, 0.6);
}


#nav-mobile{
display: none;
background: url(nav-menu.png) no-repeat center center;
float: right;
width: 60px;
height: 60px;
position: absolute;
right: 0;
top:0;
opacity: .6;

}
#nav-mobile.nav-active{
opacity: 1;
}

#content{
width: 80%;
margin: 60px 10%;
text-align: center;
overflow: hidden;
}
h2{
font-size: 50px;
font-weight: 600;
text-transform: uppercase;
color: #624c3f;
}

.texto{
display: block;
font-size: 1.0em;
color: white;
text-align: center;
padding-top: 0px;
opacity: 0.7;
}

.icono{
display: block;
margin: 15px auto;
background-color: rgba(0, 176, 80, 0.5);
width: 30px;
padding: 10px;
-webkit-border-radius: 50%;
-moz-border-radius: 50%;
-o-border-radius: 50%;
border-radius: 50%;

-webkit-box-shadow: 0px 0px 0px 30px rgba(255, 255, 255, 0);
-moz-box-shadow: 0px 0px 0px 30px rgba(255, 255, 255, 0);
-o-box-shadow: 0px 0px 0px 30px rgba(255, 255, 255, 0);
box-shadow: 0px 0px 0px 30px rgba(255, 255, 255, 0);

-webkit-transition: box shadow 0.4s;
-moz-transition: box-shadow 0.4s;
-o-transition: box-shadow 0.4s;
transition: box-shadow 0.4s;
}


.logo-celtadent{
display: block;
float: left;
margin: 15px auto;
padding: 10px;
width: 50px;
font-family: Lucida Handwriting;
font-size: 45px;
line-height: 15px;
font-weight: 100;
color: #00b050;
text-shadow: 1.5px 1.5px 1.5px rgba(255,255,255,1);
background: inherit;
}

.logo-clinica-dental{
display: block;
float: left;
margin: 30px -50px;
padding: 20px;
font-family: Papyrus;
font-size: 30px;
line-height: 40px;
font-weight: 100;
color: #000;
text-shadow: 1.5px 1.5px 1.5px rgba(255,255,255,1);
}



@media only screen and (min-width: 901px) and (max-width: 1024px) {

.logo-celtadent{
margin: 27px auto;
padding: 10px;
width: 50px;
font-size: 35px;
line-height: 0px;
}

.logo-clinica-dental{
margin: 39px -55px;
padding: 20px;
font-size: 23px;
line-height: 18px;
}
}


@media only screen and (min-width: 769px) and (max-width: 900px) {

.logo-celtadent{
margin: 25px auto;
padding: 10px;
width: 50px;
font-size: 24px;
line-height: 0px;
}

.logo-clinica-dental{
margin: 29px -63px;
padding: 20px;
font-size: 16px;
line-height: 18px;
}
}



@media only screen and (max-width: 768px) {

header{ height: 60px; position: relative;}

h2{font-size: 40px;}

#logo{
display: block;
float: left;
margin: 6px 6px 0;
height: 60px;
position: absolute;
}


#nav-mobile{ display: block; }

#menu{
width: 100%;
float: none;
padding-top: 60px;
margin-left: 0px;
}

#menu ul{
box-shadow: 0 1px 2px rgba(0,0,0,.5);
-webkit-box-shadow: 0 1px 2px rgba(0,0,0,.5);
-moz-box-shadow: 0 1px 2px rgba(0,0,0,.5);
-ms-box-shadow: 0 1px 2px rgba(0,0,0,.5);
-o-box-shadow: 0 1px 2px rgba(0,0,0,.5);

max-height: 0;
overflow: hidden;
}


#menu li{
background: #33363b;
border-bottom: 1px solid #282b30;
float: none;
width: 100%;
border: 1px solid #282b30;
height: 50px;
line-height: normal;
}

#menu li:hover{
background-color: rgb(0, 176, 80);
}


.texto{
float: left;
font-size: 1.5em;
color: white;
text-align: left;
opacity: 0.7;
padding-top: 12px;


}


.icono{
display: block;
float: left;
margin: 10px 20px auto;
background: rgba(255, 135, 15, 0.8);
width: 15px;
padding: 7px;
width: 20px;
padding: 5px;

-webkit-border-radius: 50%;
-moz-border-radius: 50%;
-o-border-radius: 50%;
border-radius: 50%;

-webkit-box-shadow: 0px 0px 0px 10px rgba(255, 255, 255, 0);
-moz-box-shadow: 0px 0px 0px 10px rgba(255, 255, 255, 0);
-o-box-shadow: 0px 0px 0px 10px rgba(255, 255, 255, 0);
box-shadow: 0px 0px 0px 10px rgba(255, 255, 255, 0);

-webkit-transition: box shadow 0.4s;
-moz-transition: box-shadow 0.4s;
-o-transition: box-shadow 0.4s;
transition: box-shadow 0.4s;

}

#menu li p.texto{
-webkit-transition: padding-top 0.4s;
-moz-transition: padding-top 0.4s;
-o-transition: padding-top 0.4s;
transition: padding-top 0.4s;
}

#menu li:hover p.texto{
padding-top: 12px;
opacity: 1;
}

#menu li:hover img.icono{
box-shadow: 0px 0px 0px 0px rgba(255, 135, 15, 0.6);
}


#menu li:last-child{ border-bottom: 0;}
#menu li a{
padding: 15px 0;
height: auto;
line-height: normal;
}
#menu li a:hover{background:#2a2d33}


#menu ul.open-menu{
max-height: 500px;
-webkit-transition: max-height .4s;
-moz-transition: max-height .4s;
-ms-transition: max-height .4s;
-o-transition: max-height .4s;
transition: max-height .4s;
}



.logo-celtadent{
margin: 5px auto;
padding: 10px;
width: 50px;
font-size: 25px;
line-height: 0px;
}

.logo-clinica-dental{
margin: 8px -65px;
padding: 20px;
font-size: 17px;
line-height: 18px;
}

}
  #2 (permalink)  
Antiguo 03/09/2015, 10:50
Avatar de michellqm  
Fecha de Ingreso: septiembre-2015
Mensajes: 21
Antigüedad: 8 años, 7 meses
Puntos: 5
Respuesta: Estilo CSS no funciona correctamente en Google Chrome, Opera y Safari

Buen día

Al parecer es un problema con el float

Para evitar que el menú te aparezca nuevamente vertical puedes hacerle una modificación a tu clase

#menu li

de la siguiente manera

Anterior:

Código:
#menu li {
display: block;
    float: left;
    text-align: center;
    width: 90px;
    height: 110px;
    webkit-transition: height 0.4s;
    -moz-transition: height 0.4s;
    -o-transition: height 0.4s;
    transition: height 0.4s;
}
Nueva:

Código:
#menu li {
display: inline-block;
    text-align: center;
    width: 90px;
    height: 110px;
    webkit-transition: height 0.4s;
    -moz-transition: height 0.4s;
    -o-transition: height 0.4s;
    transition: height 0.4s;
}
Espero que te resuelva el problema, sino me cuentas

Saludos!

Etiquetas: background, chrome, color, correctamente, estilo, float, html, todo, width
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 04:50.