Skip to content

Instantly share code, notes, and snippets.

@teffcode
Last active February 14, 2022 16:12
Show Gist options
  • Select an option

  • Save teffcode/fb661de964a7ca818034a3c615570654 to your computer and use it in GitHub Desktop.

Select an option

Save teffcode/fb661de964a7ca818034a3c615570654 to your computer and use it in GitHub Desktop.

馃憢馃徏 Welcome 馃憢馃徏

Quiz banner

Instagram | Twitter | LinkedIn


Choose your language 馃憛



English version 馃殌


Considering the following code, What would you see in the browser ?


Click here to see the correct answer and explanation 馃憖
Correct Answer Explanation
B .box .color select all elements with the class name color that are decendents of the element with the class name box, but, .box.color select the element which has a class name box and also a class name color (Like <div class="box color"></div>).

Explanation based on 馃憠馃徏 Multiple Class / ID and Class Selectors | CSS Tricks

Code:

HTML:

<div class="box">
  <div class="size color"></div>
</div>

CSS:

.size {
  width: 100px;
  height: 100px;
}

.box .color {
  background: yellow;
}

.box.color {
  background: pink;
}


Spanish version 馃殌


Considerando el siguiente c贸digo, 驴Qu茅 ver铆as en el navegador?


Haz click aqu铆 para ver la respuesta correcta y su explicaci贸n 馃憖
Respuesta correcta Explicaci贸n
B El selector .box .color selecciona los elementos con clase color que sean descendientes del elemento con clase box, en cambio, el selector .box.color selecciona el elemento que tenga la clase box y tambi茅n la clase color (Algo como <div class="box color"></div>).

Explicaci贸n basada en 馃憠馃徏 Multiple Class / ID and Class Selectors | CSS Tricks

C贸digo completo:

HTML:

<div class="box">
  <div class="size color"></div>
</div>

CSS:

.size {
  width: 100px;
  height: 100px;
}

.box .color {
  background: yellow;
}

.box.color {
  background: pink;
}


@nestorsgarzonc
Copy link

Cool, gracias me ayuda un monton a repasar una que otra cosa ya que hacer estilos en css me parece mas complejo que en flutter
En que haces los dise帽os? estan hermosos

@cquiladiaz
Copy link

Creo que la B, no estoy seguro si .box.color sea una manera valida de llamar esas dos clases. Yo siempre lo hice de la manera .box .color

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