CSS - właściwości position


position

kod wynik kodu
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-2">
<meta http-equiv="Content-Language" content="pl">
<title>CSS - visual formatting</title>
<link rel="Stylesheet" type="text/css" href="style.css" />
<style type="text/css">
h2 {
  top: 50px;
  left: 50px;
  padding: 20px;
}
.static {
  position: static;
  background: yellow;
}
.relative {
  position: relative;
  background: orange;
}
.absolute {
  position: absolute;
  background: red;
}
.fixed {
  position: fixed;
  background: violet;
}
.sticky {
  position: sticky;
  background: lime;
}
</style>
</head>
<body>

<h2 class="static">static position</h2>
<h2 class="relative">relative position</h2>
<h2 class="absolute">absolute position</h2>
<h2 class="fixed">fixed position</h2>
<h2 class="sticky">sticky position</h2>

</body>
</html>