If the `position` property has a default `static` value which does not need to be specified, why does this value even exist in the first place?


#1

Question

If the position property has a default static value which does not need to be specified, why does this value even exist in the first place?

Answer

This value still needs to be specified for two main reasons:

  1. Default styles come from the style sheet the browser applied to an HTML document. These default styles within this user agent style sheet still need to be defined.

  2. We may need to override the position property. For example, say we want an element to have position: fixed; in desktop view but the default position: static; declaration in mobile view. In this case we may need the override the fixed positioning within a media query.