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

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

"width" Example

    
<html>
<body>
<img id="myImg" 
     src="http://www.wbex.ru/style/logo.png" 
     width="132">
<br>
<input type="button" value="Shrink image" onclick="myImg.style.width="20"">
<input type="button" value="Restore image" onclick="myImg.style.width="132"">
</body>
</html>



"width" is applied to

+----------------+--------------------------------------------------------------+
| Applied_To     |<a>                             <acronym>                     |
|                |<address>                       <applet>                      |
|                |<b>                             <bdo>                         |
|                |<big>                           <blockquote>                  |
|                |<button>                        <caption>                     |
|                |<center>                        <cite>                        |
|                |<code>                          currentStyle                  |
|                |<custom>                        <dd>                          |
|                |<del>                           <dfn>                         |
|                |<dir>                           <div>                         |
|                |<dl>                            <dt>                          |
|                |<em>                            <fieldset>                    |
|                |<font>                          <form>                        |
|                |<hn>                            <hr>                          |
|                |<i>                             <ins>                         |
|                |<kbd>                           <label>                       |
|                |<legend>                        <li>                          |
|                |<listing>                       <menu>                        |
|                |<nobr>                          <ol>                          |
|                |<option>                        <p>                           |
|                |<pre>                           <q>                           |
|                |<rt>                            <ruby>                        |
|                |runtimeStyle                    <s>                           |
|                |<samp>                          <select>                      |
|                |<small>                         <span>                        |
|                |<strike>                        <strong>                      |
|                |style                           <sub>                         |
|                |<sup>                           <textarea>                    |
|                |<tt>                            <u>                           |
|                |<ul>                            <var>                         |
|                |<xmp>                                                         |
+----------------+--------------------------------------------------------------+



"width" Possible Values

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



"width" Syntax and Note

Note:
Sets the element width.
Syntax:
    
element { width: value }
elementID.style.width = "value"
document.all.elementID.style.width = "value" // IE only