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 ?
4 Answers
position: static;
The default position is static for any html element if not specified explicitly.
-
14Check using Chrome :
Click On the Element --> Computed --> Filter --> Show All
. Hope helps someone.– Shaiju TMar 19, 2016 at 12:50 -
ICYMBI: a quick google search yeilds - "Static positioning is the default positioning model for elements. They are displayed in the page where they rendered
as part of normal HTML flow
" Jul 31, 2016 at 2:44 -
@CotyEmbry would you like explain what does 'ICYMBI' means for non-English native speakers? I did a google search for that but found nothing. Jul 8, 2017 at 12:08
-
static
is always the initial value for the CSS property position
no matter which tag.
References:
-
6There's a difference between the "default" value for an element, and a property's "initial value". In this case there is no browser default for
div
elements so they just take on the initial value,static
. May 1, 2013 at 11:01
Unless it was inherited from some of its parents the default is static
-
11It won't inherit from parent elements unless it is explicitly set to
position: inherit
– QuentinMay 1, 2013 at 11:04
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.