CSS背景

CSS背景
  • 3D背景模型
3D背景模型
  • 属性
  • background-color
  • background-image
  • background- repeat
  • background- position
  • background-size
  • background-attachment
  • background-clip
  • background-origin
  1. background-color
    <color> = <rgb()> | <rgba()> | <hsl()> | <hsla()> | <hex-color> | <named-color> | currentcolor | <deprecated-system-color>

  2. background-image
    background-image: url()

  3. background- repeat
    在什么方向上重复。

/* One-value syntax */
background-repeat: repeat-x;
background-repeat: repeat-y;
background-repeat: repeat;
background-repeat: space;//调整图像间空隙来占满空间而不被裁剪
background-repeat: round;//伸缩调整图像大小占满空间而不被裁剪,没有空隙!
background-repeat: no-repeat;
/* Two-value syntax: horizontal | vertical */
background-repeat: repeat space;
background-repeat: repeat repeat;
background-repeat: round space;
background-repeat: no-repeat round;
background-repeat: inherit;
  1. background- position
    背景图上定位初始位置(左上角);
    一般和sprite图结合使用;

  2. background-size
    背景缩放:指定大小宽高、cover ;拉伸刚好占满空间、contain;缩放保持宽高比。知道宽或高触及背景区边缘;

  3. background-attachment
    背景是否跟随页面滚动

background-attachment:scroll;//默认不跟随页面滚动
background-attachment:fixed;//跟随页面滚动
  1. background-clip
    背景出现的区域:
background-clip: border-box //背景至边框以内(包括边框)
background-clip: padding-box//背景内边距以内(包括内边距下)
background-clip: content-box//背景只有内容下有
background-clip: inherit
  1. background-origin
    background-origin
    指定背景图片background-image属性的原点位置的背景相对区域.
    注意:当 background-attachment: fixed时,该属性将被忽略;
background-clip: border-box //背景图在边框以内(包括边框)
background-clip: padding-box//背景图在内边距以内(包括内边距下)
background-clip: content-box//背景图只有内容下有
background-clip: inherit
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • 选择qi:是表达式 标签选择器 类选择器 属性选择器 继承属性: color,font,text-align,li...
    wzhiq896阅读 5,776评论 0 2
  • 选择qi:是表达式 标签选择器 类选择器 属性选择器 继承属性: color,font,text-align,li...
    love2013阅读 6,826评论 0 11
  • 背景颜色:background-color背景图片:background-image平铺图片:background...
    陈老板_阅读 1,215评论 0 0
  • 晨读,维特根斯坦读一阵,就要换本书读两天,不然感觉自己会疯魔,最好是这样的图文并茂。 上午阳光还是淡淡的,从双层玻...
    绿百合阅读 1,027评论 0 0
  • 6.3.1、转型产品经理 通过前面的几个大章节,详细的介绍了产品经理的工作内容和知识结构,现在再谈转型产品经理的话...
    唐杰阅读 2,507评论 0 0