CSS Layout How to - Place 200px to browser top








Question

We would like to know how to place 200px to browser top.

Answer


<!DOCTYPE html>
<html lang="en">
<head>
<title>Example of CSS absolute positioning</title>
<style type="text/css">
p {<!--from   w w  w . j a v a  2  s  .com-->
  background: #FFB6C1;
  padding: 10px;
}

p.positioned {
  position: absolute;
  top: 200px;
}
</style>
</head>
<body>
  <p>This is a normal paragraph.</p>
  <p class="positioned">The top margin edge of this paragraph is
    shifted below by 100px from the top edge of the document's viewport.</p>
</body>
</html>

The code above is rendered as follows: