HTML/CSS/Style Basics/url

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

background-image using the url function, which takes the URL of a file as its only parameter

 
. 

<html>
<head>
<title>Set URL for Background Image </title>
    <style type="text/css">
        div { background:url("http://www.wbex.ru/style/logo.png") no-repeat; width:250px; height:76px; } 
    </style>
</head>
<body>
<h1>Background Image</h1> 
<div></div> 
</body>
</html>



list-style-image: url("collapsed_folder.gif");

 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
    <head>
        <title></title>
        <style type="text/css">
            li {
                list-style-image: url("collapsed_folder.gif");
            }
            li + li + li + li + li {
                list-style: inside url("exploded_folder.gif");   
            }
        </style>
    </head>
    <body>
        <ul>
            <li> My Pictures</li>
            <li> My Music</li>
            <li> My Documents</li>
            <li> My Computer</li>
            <li> Control Panel</li>
        </ul>
    </body>
</html>



you only have to put a URL in quotes if the URL contains whitespace.

 
<html>
<head>
<title>Set URL for Background Image </title>
    <style type="text/css">
        div { background:url("your file name.png") no-repeat; width:250px; height:76px; } 
    </style>
</head>
<body>
<h1>Background Image</h1> 
<div></div> 
</body>
</html>