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

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

"background-attachment" Example

   <source lang="html4strict">
   

<html> <head> </head> <body>

           








           








           background-attachment is fixed.

</body> </html>


     </source>
   
  


Use background-attachment:fixed to prevent the image from scrolling.

   <source lang="html4strict">

<!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"> <head> <title></title> <style type="text/css">

  • .bg-ry {
 background-attachment: fixed;
 background-position: center top;
 width: 300px;
 height: 300px;
 background-image: url(http://www.wbex.ru/style/logo.png);

} </style> </head> <body>

Background image repeat-y →

</body> </html>

</source>
   
  


Use background-attachment:scroll to scroll a background image when the user scrolls the content. This is the default value.

   <source lang="html4strict">

<!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"> <head> <title></title> <style type="text/css">

  • .bg-ry {
 background-attachment: scroll;
 background-position: center top;
 width: 300px;
 height: 300px;
 background-image: url(http://www.wbex.ru/style/logo.png);

} </style> </head> <body>

Background image repeat-y →

</body> </html>

</source>