css3基础内容笔记1 -- 背景

  • background-color:指定元素的背景色
    • opacity 属性指定元素的不透明度/透明度。取值范围为 0.0 - 1.0。值越低,越透明(使用 opacity 属性为元素的背景添加透明度时,其所有子元素都继承相同的透明度,不希望对子元素应用不透明度使用 RGBA 颜色值)
  • background-image:指定用作元素背景的图像(默认情况下,图像会重复,以覆盖整个元素)
    • .page{
           background-image: url("tp1.gif");
      }
  • background-repeat:
    • 仅在水平方向重复 :background-repeat: repeat-x;
    • 垂直重复图像:background-repeat: repeat-y;
    • 只显示一次背景图像:background-repeat: no-repeat;
  • background-attachment:指定背景图像是应该滚动还是固定的(不会随页面的其余部分一起滚动)
    • //指定应该固定背景图像
      .page{
            background-image: url("tp1.png");
            background-repeat: no-repeat;
            background-position: right top;
            background-attachment: fixed;
      }

  • background-position:用于指定背景图像的位置
    • //把背景图片放在右上角
      .page{
        background-image: url("tp1.png");
        background-repeat: no-repeat;
        background-position: right top;
      }
      //指定背景图像应随页面的其余部分一起滚动
      .page{
        background-image: url("tp1.png");
        background-repeat: no-repeat;
        background-position: right top;
        background-attachment: scroll;
      }

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值