HTML/CSS/CSS Attributes and Javascript Style Properties/top

Материал из Web эксперт
Перейти к: навигация, поиск

top: 100px

 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html>
        <head>
            <title></title>
            <style type="text/css">
        p {
            margin: 10px;
            padding: 10px;
            color: black;
            border: thin solid;
            width: 250px;
            top: 100px;
            line-height: 3em;
            font-size: 1em;
        }
            </style>
        </head>
        <body>
      <p>
this is a test. this is a test. this is a test. this is a test. 
this is a test. this is a test. this is a test. this is a test. 
this is a test. this is a test. this is a test. this is a test. 
      </p>
        </body>
    </html>



"top" Example

    
<html>
<body>
<p>
<center>
<img id="myImg" 
     src="http://www.wbex.ru/style/logo.png" 
     width=74 height=100" 
     style="position:relative">
www.wbex.ru
</center>
</p>
<input type="button" value="Set top property to 100" onclick="myImg.style.top=100">
<input type="button" value="Set top property to 200" onclick="myImg.style.top=200">
<input type="button" value="Restore image position" onclick="myImg.style.top=0">
</body>
</html>