¿Debo establecer una altura fija o usar relleno para establecer la altura de un fondo de texto?

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?

preguntado el 28 de mayo de 14 a las 14:05

Tal vez puedas usar min-height en lugar de height. This way, if your text goes bigger, your menu will resize. -

can u share a fiddle file? -

1 Respuestas

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 or haz tu propia pregunta.