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

Материал из Web эксперт
Версия от 08:19, 26 мая 2010; Admin (обсуждение | вклад) (1 версия)
(разн.) ← Предыдущая | Текущая версия (разн.) | Следующая → (разн.)
Перейти к: навигация, поиск

"top" Example

    
<html>
<body>
<p>
<center>
<img id="myImg" 
     src="http://www.wbex.ru/style/logo.png" 
     width=74 height=100" 
     style="position:relative">
</p>
</center>
<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>



"top" is applied to

+----------------+--------------------------------------------------------------+
| Applied_To     |<a>                             <address>                     |
|                |<applet>                        <b>                           |
|                |<big>                           <blockquote>                  |
|                |<button>                        <center>                      |
|                |<cite>                          <code>                        |
|                |currentStyle                    <custom>                      |
|                |<dd>                            defaults                      |
|                |<dfn>                           <dir>                         |
|                |<div>                           <dl>                          |
|                |<dt>                            <em>                          |
|                |<embed>                         <fieldset>                    |
|                |<font>                          <form>                        |
|                |<hn>                            <hr>                          |
|                |<i>                             <iframe>                      |
|                |<img>                           <inputtype="button">          |
|                |<input type="checkbox">         <input type="file">           |
|                |<input type="image">            <input type="password">       |
|                |<input type="radio">            <input type="reset">          |
|                |<inputtype="submit">            <input type="text">           |
|                |<isindex>                       <kbd>                         |
|                |<label>                         <legend>                      |
|                |<li>                            <listing>                     |
|                |<marquee>                       <menu>                        |
|                |<object>                        <ol>                          |
|                |<p>                             <pre>                         |
|                |runtimeStyle                    <s>                           |
|                |<samp>                          <select>                      |
|                |<small>                         <span>                        |
|                |<strike>                        <strong>                      |
|                |style                           <sub>                         |
|                |<sup>                           <table>                       |
|                |<textarea>                      <tt>                          |
|                |<u>                             <ul>                          |
|                |<var>                           <xmp>                         |
+----------------+--------------------------------------------------------------+



"top" Possible Values

Possible Values
auto            The default; regular HTML position
length          A floating-point number followed by a unit designator
percentage      Percent height of the parent object



"top" Syntax and Note

Note:
Set the element top position relative to the next element top edge.
Syntax:
    
element { top: value }
elementID.style.top = "value"
document.all.elementID.style.top = "value" // IE only