2

While editing website in Chrome develpoer tools I've recently found that over the margin, padding and border there is a position in which you can type a number.

enter image description here

What does it do, and how could it be used ?

Could I use it with position:10px; ?

EDIT: How to use it with number values ?

Giedrius
  • 603
  • 1
  • 6
  • 26
  • there you go, http://www.w3schools.com/css/css_positioning.asp , and this https://developer.mozilla.org/en-US/docs/Web/CSS/position – pol Aug 29 '16 at 18:43
  • 1
    That will show the values for : **Left // Right // Top // Bottom** That you can use on elements with a non-static `position` value. – DaniP Aug 29 '16 at 18:44
  • 1
    I know that position can have, static|absolute|fixed|relative|initial|inherit , this is old news, how about the numbers ? – Giedrius Aug 29 '16 at 18:46
  • 2
    Left // Right // Top // Bottom values ... – DaniP Aug 29 '16 at 18:49

1 Answers1

0

Position can be of four types:

static
relative
fixed
absolute

A very good article can be found here:

static is the default. An element with position: static; is not positioned in any special way. A static element is said to be not positioned and an element with its position set to anything else is said to be positioned.

relative behaves the same as static unless you add some extra properties.

</div>
<div class="relative2">

Setting the top, right, bottom, and left properties of a relatively-positioned element will cause it to be adjusted away from its normal position. Other content will not be adjusted to fit into any gap left by the element.

A fixed element is positioned relative to the viewport, which means it always stays in the same place even if the page is scrolled. As with relative, the top, right, bottom, and left properties are used.

absolute behaves like fixed except relative to the nearest positioned ancestor instead of relative to the viewport. If an absolutely-positioned element has no positioned ancestors, it uses the document body, and still moves along with page scrolling. A "positioned" element is one whose position is anything except static.

An example can be:

.relative {
  position: relative;
  width: 600px;
  height: 400px;
}
.absolute {
  position: absolute;
  top: 120px;
  right: 0;
  width: 300px;
  height: 200px;
}
Pritam Banerjee
  • 17,953
  • 10
  • 93
  • 108
  • This is a nice into to CSS position values in general, but the OP is asking about numerical values found alongside those for the other CSS positioning attributes like margin, padding, etc. when using Chrome's Inspect Element feature. – rainbowsorbet Mar 20 '18 at 23:02