天天看點

CSS中背景圖檔滾動屬性background-attachment

   該屬性用來定義背景圖檔是否随浏覽器滑塊的拖動而滾動,在背景圖檔滾動屬性中,可以使用兩個屬性值,分别為scroll和fixed,

     background-attachment: scroll | fixed;

     *scroll:   背景圖檔随滑塊的變化而滾動。

     *fixed: 背景圖檔固定不動。

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <title> New Document </title>
  <meta name="Generator" content="EditPlus">
  <meta name="Author" content="">
  <meta name="Keywords" content="">
  <meta name="Description" content="">
  <style>
    div {
    background-position: center;
    background-repeat: no-repeat;
    background-image: url(images/round.jpg);
    width: 400px;
    height: 100px;
    background-attachment: scroll;
  }
  </style>
 </head>
 <body>
    <div>這是背景圖檔滾動屬性的執行個體</div>
 </body>
</html>