zoukankan      html  css  js  c++  java
  • css背景图片

    background-img:url

    1.图片大于元素,图片显示不全

    2.图片小于元素,图片会重复平铺

    3.图片和背景会同时存在

    • background-repeat:repeat,横向和纵向平铺
    • background-repeat:norepeat,背景图片不会重复,有多大,显示多大.
    • background-repeat:repeat-x;
    • background:-repeat:repeat -y;背景图片沿着y轴重复

    4.background-position:(修改背景图片位置)

      top left,center,bottom right,中的两个值来指定

      background-position:水平方向的距离 垂直方向的距离

    5.background-attachment:一般不改变背景图片的话,把他设置给body,而不设置给元素,因为一旦设置给元素就会导致元素消失的时候图片也消失

      background-attachment:scroll:会随滚动条滚动

      backgroun-attachment:fixed固定元素(他的位置是相对于窗口的,不随页面滚动作为阅读,博客)

    简写:没有顺序和数量的要求background:#bfa url(img/3.png) center center no-repeat fixed:

  • 相关阅读:
    2021年4月1日
    2021年3月31日
    2021年3月30日
    2021年3月29日
    2021年3月27日
    2021年3月26日
    2021年3月25日
    人件集阅读笔记03
    2020年3月24日
    构建之法阅读笔记02
  • 原文地址:https://www.cnblogs.com/1521681359qqcom/p/12956749.html
Copyright © 2011-2022 走看看