HTML CSS Reference/CSS Attributes and Javascript Style Properties/background attachment

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

"background-attachment" Example

    
<html>
<body>
<div style="background:blue url(http://www.wbex.ru/style/logo.png) repeat top left; 
            width:200; 
            border:3; 
            height:150; font-size:14">www.wbex.ru</div>
            <br><br><br><br><br><br><br><br><br>
<div style="background-color:red; 
            background-attachment:fixed; 
            background-image:url(http://www.wbex.ru/style/logo.png); 
            background-repeat:repeat; 
            background-position-x:top; 
            background-position-y:left; 
            width:200; 
            border:3; 
            height:150; 
            font-size:14">www.wbex.ru</div>
Text
</body>
</html>



"background-attachment" is applied to

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



"background-attachment" Possible Values

Possible Values
fixed          keeps the image stationary.
scroll         image scrolls with the object.



"background-attachment" Syntax and Note

Note:
Whether the background image remains fixed or scrolls with the content.
Syntax:
    
element { background-attachment: value }
elementID.style.backgroundAttachment = "value"
document.all.elementID.style.backgroundAttachment = "value" // IE only