position:relative; top:20px; left:20px; : position « CSS « HTML / CSS






position:relative; top:20px; left:20px;

  
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>CSS Positioning Example</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type='text/css'>
/* CSS Document */

div, h1, p {
  font-family:arial, verdana, sans-serif;
  border:1px solid #000000;
  margin:5px;
  width:300px;}

div#page2 {
  position:relative;
  top:20px;
  left:20px;}
</style>


</head>

<body>
  <div id="page1">
    <h1>This is the heading</h1>
    <p>Here is paragraph one.</p>
    <p>Here is paragraph two.</p>
    <p>Here is paragraph three.</p>
  </div>
  <div id="page2">
    <h1>This is the heading</h1>
    <p>Here is paragraph one.</p>
    <p>Here is paragraph two.</p>
    <p>Here is paragraph three.</p>
  </div>
</body> 

</html>

   
    
  








Related examples in the same category

1.'position' Example
2.position: absolute; top: 0; left: 0;
3.position: absolute; top: 0; right: 0;
4.position: absolute; bottom: 0; left: 0;
5.position: absolute; bottom: 0; right: 0;
6.position-absolute
7.position-absolute: offset
8.position absolute offset: bottom left
9.position absolute offset: bottom right
10.position absolute offset: no width no height
11.position absolute offset: right
12.position absolute offset: top right bottom left
13.position fixed
14.position relative
15.position: relative, absolute
16.position: relative;
17.position: relative; top: 25px; left: 25px;
18.position: relative; top: 10px; left: 10px;
19.Relative Positioning
20.Absolute Positioning
21.Fixed Positioning
22.Floating Positioning
23.CSS Positioning
24.HTML to demonstrate CSS positioning
25.Absolute position from the bottom
26.position: relative; top: 100px; left: 20px;
27.background-position: 75px 150px;
28.Positioning Items
29.positioned in relation to containing element
30.CSS Positioning
31.CSS positioning
32.CSS positioning 2
33.Using absolute positioning to center a box onscreen
34.The list-style property: combine three separate properties, list-style-type, list-style-image, and list-style-position
35.Elements that are absolutely positioned are positioned, by default, relative to the browser's viewport.
36.This element is positioned to the bottom right of the relatively positioned element.
37.Elements in fixed position stay in place, even when a document is scrolled and are positioned relative to the browser's viewport.
38.position: absolute; and nested effect
39.Image positioned in relation to containing element