¿Debo establecer una altura fija o usar relleno para establecer la altura de un fondo de texto?
Frecuentes
Visto 41 equipos
0
I know this is probably a stupid question. But say I have a navigation menu, would it be more practical to set a fixed height..
nav {
background: red;
Width: 80%;
height: 60px;
}
nav ul li {
Line-height: 60px;
}
Or to use padding to define the height?
nav {
background: red;
Width: 80%;
Padding: 30px 0;
}
I usually go with the first choice. But I'm worried that the font size might change in different computers/browsers and therefore becomes unproportional with the container. Could this actually happen?
1 Respuestas
0
Your vertical padding should probably go on the
nav ul li a
That way, if the anchor text scales up, so does your header and everything doesn't break out, and you have a larger clickable area. Also, don't leave the anchor display inline.
contestado el 28 de mayo de 14 a las 15:05
No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas html css or haz tu propia pregunta.
Tal vez puedas usar
min-height
en lugar deheight
. This way, if your text goes bigger, your menu will resize. - Agatecan u share a fiddle file? - user2628521