美文网首页
background-attachment

background-attachment

作者: ismyshellyiqi | 来源:发表于2018-03-20 11:05 被阅读0次

background-attachment:

  • 默认值是scroll

  • fixed 不会随着其他的部分的滚动而滚动

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>demo01</title>
  <style media="screen">
    html,body{
      width: 100%;
      height: 100%;
    }
    .box{
      width: 100%;
      height: 100%;
      overflow-y: scroll;
      overflow-x: hidden;
    }
    .cont1{
      width: 100%;
      height: 400px;
      background-image: url('http://www.alloyteam.com/wp-content/uploads/2014/01/section01.jpg');
      background-size: cover;
      background-repeat: no-repeat;
      background-position: center;
      background-attachment: fixed;

    }
    .cont2{
      width: 100%;
      height: 400px;
      background-image: url('http://www.alloyteam.com/wp-content/uploads/2014/01/section02.jpg');
      background-size: cover;
      background-repeat: no-repeat;
      background-position: center;
      background-attachment: fixed;

    }
    .cont3{
      width: 100%;
      height: 400px;
      background-image: url('http://www.alloyteam.com/wp-content/uploads/2014/01/section03.jpg');
      background-repeat: no-repeat;
      background-size: cover;
      background-position: center;
      background-attachment: fixed;

    }
  </style>
</head>
<body>
  <div class="box">
    <article class="cont1">

    </article>
    <article class="cont2">

    </article>
    <article class="cont3">

    </article>
  </div>
</body>
</html>

相关文章

  • css-background

    background-image background-repeat background-attachment ...

  • CSS:background-attachment属性

    background-attachment:scroll | fixed | inherit scroll,默认值...

  • background-attachment

    background-attachment: 默认值是scroll fixed 不会随着其他的部分的滚动而滚动

  • Tailwind Background

    背景滚动(background attachment) CSS提供的background-attachment属性...

  • CSS3

    背景 background-attachment:backgroun-size:contain //正好容下 li...

  • css实现双重背景图,过度动画,缩放等

    background-attachment: fixed;background-size: cover;实现背景图...

  • 滚动视差css

    background-attachment http://web.jobbole.com/95068/以上效果主要...

  • CSS review

    background-attachment:fixed/scroll/inherit背景图像固定/随着页面的其余部...

  • HTML+CSS杂记

    1、background-attachment有三个值:scroll、fixed、inherit scroll是默...

  • background-attachment属性

    做网站时想实现背景图不动,上面的内容动的效果.网上搜一下,找到了一篇不错的文章 以下内容均引入自backgroun...

网友评论

      本文标题:background-attachment

      本文链接:https://www.haomeiwen.com/subject/fbapfftx.html