Setting offsets position: absolute


Im confused why properties

top: 0px;
left: 0px;

enable the blue header to be seen.
I understand that property position: absolute; means that the element will be pinned there is it because of the overlap? if it overlaps then we must specify an offset?

.header {
  background-color: #466995;
  border-bottom: 1px solid #466995;
  overflow-y: auto;
  width: 100%;
  position: absolute;
  top: 0px;
  left: 0px


If offset properties aren't specified, it's possible for the div's content to overlap with other content on the page, especially since other elements with ignore the div.

Offset properties can be set in order to avoid this problem. The specific offset values will depend on what makes the best sense for the content of a web page.

Simply "just in case", use those values to avoid any unintentional overlaps.


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.