a div in another div with position Absolute will have position Absolute too?

Asked

Viewed 133 times

2

If I have a div inside another div:

<div id="div1">
    <div id="div2"></div>
</div>

And for div1 I set position Absolute:

#div1 {
    position: absolute;
}

The div2 will also have position Absolute?

  • Yeah, that’s called a waterfall effect.

1 answer

2


Not really. Any html element has position as static, unless another value is specified explicitly. Source, Source 2

It is also possible to confirm this as the sample html that put used the browser inspect and accessing the calculated css values (computed):

inserir a descrição da imagem aqui

Browser other questions tagged

You are not signed in. Login or sign up in order to post.