What is the default value of "position" attribute of a DIV?
I was just wondering what could be the default "position" attribute of a DIV ? Just the way a DIV has display property as BLOCK, what is the default property for position attribute ?
position: static;
The default position is static for any html element if not specified explicitly.
static
is always the initial value for the CSS property position
no matter which tag.
References:
- MDN
- W3C I
- W3C II
Unless it was inherited from some of its parents the default is static
Its Static. The proof of its static positioning.
The HTML:
<div class="position"> <div>
<div style="height:100px;"> </div>
<div class="noposition"> <div>
The CSS:
div.position
{
width:100px;
height:100px;
background:red;
left:10px;
top:100px;
position:static;
}
div.noposition{
width:100px;
height:100px;
background:blue;
left:10px;
top:100px;
}
It shows that Two divs with separate classes, one without any positioning and one with a static position, positions both the Div's as static.