Skip to content

Instantly share code, notes, and snippets.

@teffcode
Last active May 27, 2021 16:08
Show Gist options
  • Save teffcode/279d09730612178616d0428fde1fbb3a to your computer and use it in GitHub Desktop.
Save teffcode/279d09730612178616d0428fde1fbb3a to your computer and use it in GitHub Desktop.

👋🏼 Welcome 👋🏼

Quiz banner

Instagram | Twitter | LinkedIn


Choose your language 👅



English version 🚀


Which of the following line-height values will achieve the p element have a 32px of height ?


Click here to see the correct answer and explanation 👀
Correct Answer Explanation
A and B The line-height CSS property sets the height of a line box. The used value (2) is multiplied by the element's own font size (16px). For this reason, the correct answer is 2 (2 * 16 = 32).

Explanation based on 👉🏼 line-height | MDN

Code:

HTML:

<p>I'm a paragraph</p>

CSS:

p {
  line-height: 2;
  background: skyblue;
}


Spanish version 🚀


¿Cuál de los siguientes valores de line-height logrará que el elemento p tenga una altura de 32px?


Haz click aquí para ver la respuesta correcta y su explicación 👀
Respuesta correcta Explicación
A y B La propiedad de CSS line-height establece la altura de una casilla remarcada por líneas (aunque comúnmente se usa para establecer la distancia entre líneas de texto). En este caso, el valor de line-height 2 es multiplicado por el tamaño de fuente propio del elemento p (16px). Por esta razón, la respuesta correcta es 2, ya que 2 * 16 = 32. También, si el valor de line-height es en longitud (como 32px), este se utiliza en el cálculo de la altura de la casilla encuadrada por líneas.

Explicación basada en 👉🏼 line-height | MDN

Código completo:

HTML:

<p>I'm a paragraph</p>

CSS:

p {
  line-height: 2;
  background: skyblue;
}


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment