CSS Property Value How to - position: absolute;








Question

We would like to know how to position: absolute;.

Answer


<!DOCTYPE html>
<html lang="en">
<head>
<title>Example of CSS positioning</title>
<style type="text/css">
p {<!--from ww  w .j av  a2 s  .c  o m-->
  width: 200px;
  padding: 10px;
}

.up {
  background: #ee665a;
  position: absolute;
  top: 0;
}

.down {
  background: #b0d878;
  position: absolute;
  bottom: 0;
}
</style>
</head>
<body>
  <p class="up">This paragraph is placed at the top of the document's
    viewport.</p>
  <p class="down">This paragraph is placed at the bottom of the
    document's viewport.</p>
</body>
</html>

The code above is rendered as follows: