Select any child of a css element

0

Is there the possibility of selecting all the children of a certain element, even though they are different? I put an example code;

<div id='contenedor'>
    <a href='#'>Esto es un ejemplo>
    <h1>Ejemplo h1</h1>
    <p>Parrafo de ejemplo</p>
</div>

I mean to be able to give styles to all the elements within the div id='contenedor' in a single statement. For example, that the elements a , h1 and p have a margin of 20px.

    
asked by asantana o 06.12.2017 в 00:15
source

1 answer

1

You can use * right after your parent selector to apply style to your children like this:

#contenedor * {
  margin: 20px;
}
    
answered by 06.12.2017 / 00:22
source