HTML/CSS/CSS Attributes and Javascript Style Properties/background repeat

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

"background-repeat" Example

    
<head>
<style>
#myL {background-color:#EEEEEE; 
      background-image:url("http://www.wbex.ru/style/logo.png");
      height:500; 
      background-repeat:repeat; 
}
</style>
</head>
<body>
<div id="myL" style="width:500"></div>
</body>
</html>



background-repeat: no-repeat

 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  <title>No repeat</title>
  <style type="text/css">
  body { 
    background-image: url(images/background.gif);
    background-repeat: no-repeat;
  }
  </style>  
</head>
<body>
  
  <p>this is a text.</p>
  <p>this is a text.</p>
  <p>this is a text.</p>
  <p>this is a text.</p>
  <p>this is a text.</p>
  <p>this is a text.</p>
  <p>this is a text.</p>
  <p>this is a text.</p>
  <p>this is a text.</p>
</body>
</html>



background-repeat: repeat-x

 
<!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">
            html, body {
                height: 1000px;
            }
            body {
                background-image: url("backgroundImage.jpg");
                background-repeat: repeat-x;
            }
        </style>
    </head>
    <body>
    </body>
</html>



background-repeat: repeat-y

 
<!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">
            html, body {
                height: 1000px;
            }
            body {
                background-image: url("backgroundImage.jpg");
                background-repeat: repeat-y;
            }
        </style>
    </head>
    <body>
    </body>
</html>



The background-repeat Property

 
Value       Purpose
repeat      This causes the image to repeat to cover the whole page.
repeat-x    The image will be repeated horizontally across the page (not down the whole page vertically).
repeat-y    The image will be repeated vertically down the page (not across horizontally).
no-repeat   The image is displayed only once.