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

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

"background-image" Example

    
<html>
<head>
</head>
<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">Text
Text
Text
Text
Text
</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">
Text
Text
Text
Text
Text
Text
Text
            </div>
</body>
</html>



"background-image" 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>                           |
|                |<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>                        |
|                |<nobr>                          <ol>                          |
|                |<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-image" Possible Values

Possible Values
url(pathname)         The pathname is the absolute or relative URL of the image file
none                  The default, which causes the underlying background to show through



"background-image" Syntax and Note

Note:
URL of the background image.
Syntax:
    
element { background-image: value }
elementID.style.backgroundImage = "value"
document.all.elementID.style.backgroundImage = "value" // IE only