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

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

"clip" Example

    
<html>
<body>
<img id="myImg" 
     src="yourimage.gif" 
     height="80" 
     width="120" 
     border="0" 
     style="position:absolute;top:200px;left:375px">
    <center>
        <button onclick="myImg.style.clip="rect(25px auto auto auto)"">
            Applying top value
        </button>
        <button onclick="myImg.style.clip="rect(auto 100px auto auto)"">
            Applying right value
        </button>
        <button onclick="myImg.style.clip="rect(auto auto 60px auto)"">
            Applying bottom value
        </button>
        <button onclick="myImg.style.clip="rect(auto auto auto 50px)"">
            Applying left value
        </button>
        <button style="position:absolute;top:250px;left:450px" 
                onclick="myImg.style.clip="rect(auto)"">Restore image</button>
</body>
</html>



"clip" is applied to

+----------------+--------------------------------------------------------------+
| Applied_To     |<a>                             <address>                     |
|                |<applet>                        <b>                           |
|                |<bdo>                           <big>                         |
|                |<blockquote>                    <button>                      |
|                |<center>                        <cite>                        |
|                |<code>                          <custom>                      |
|                |<dd>                            defaults                      |
|                |<dfn>                           <dir>                         |
|                |<div>                           <dl>                          |
|                |<dt>                            <em>                          |
|                |<embed>                         <fieldset>                    |
|                |<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>                           <ruby>                        |
|                |runtimeStyle                    <s>                           |
|                |<samp>                          <select>                      |
|                |<small>                         <span>                        |
|                |<strike>                        <strong>                      |
|                |style                           <sub>                         |
|                |<sup>                           <table>                       |
|                |<td>                            <textarea>                    |
|                |<th>                            <tr>                          |
|                |<tt>                            <u>                           |
|                |<ul>                            <var>                         |
|                |<xmp>                                                         |
+----------------+--------------------------------------------------------------+



"clip" Possible Values

Possible Values
auto             The default; the element is rendered completely.
rect             The size of the region in the order top, right, bottom, left.



"clip" Syntax and Note

Note:
Defines a clipping region for an element using absolute positioning. 
Use JavaScript properties clipBottom, clipLeft, clipRight, clipTop to
clip only one of the bottom, left, right, and top regions. 
Syntax:
    
element { clip: values }
elementID.style.clip = "values"
document.all.elementID.style.clip = "values" // IE only