User Tools

Site Tools


css:position:absolute_vs_relative_vs_static

This is an old revision of the document!


CSS - Position - Absolute vs Relative vs Static

index.html

<div class=”parent”>
 <div class=”box” id=”one”>One</div>
 <div class=”box” id=”two”>Two</div>
 <div class=”box” id=”three”>Three</div>
 <div class=”box” id=”four”>Four</div>
</div>

style.css

.parent {
 border: 2px black dotted;
 display: inline-block;
}.box {
 display: inline-block;
 background: red;
 width: 100px;
 height: 100px;
}#two {
  background: green;
}

<html> .parent { border: 2px black dotted; display: inline-block; }.box { display: inline-block; background: red; width: 100px; height: 100px; }#two {

background: green;

}

One

Two

Three

Four

</html>

css/position/absolute_vs_relative_vs_static.1628424187.txt.gz · Last modified: 2021/08/08 12:03 by peter

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki