更多资源来源于菜鸟教程:http://www.runoob.com/css/css-background.html;

个人对于background的理解:

background属于复合样式(css样式):颜色,url,repeat/no-repeat,是否固定,position(定位);

分别为:background-color,background-image,background-repeat,background-attachment,background-position;

background-image在css3中,可以引入多张图片,对应的background其他的属性都具有多个属性值,例:

background的用法

css3中background中增加了其他的新属性:background-size,background-Origin(指定背景图像的区域),back-clip(规定背景绘制区域);

background-size:宽度,高度;

background-origin:content-box;该属性有三个值:content-box,padding-box,border-box;

padding-box和border-box实现的效果类似;

background的用法

content-box实现的效果,占据内容局域:

background的用法

backgound-clip(规定背景绘制区域): content-box;目前只有content-box和padding-box;

background的用法

content-box

background的用法


background-attachment(设置背景图像是否固定或者随着页面的其余部分滚动。)

scroll 背景图片随页面的其余部分滚动。这是默认
fixed 背景图像是固定的
inherit 指定background-attachment的设置应该从父元素继承

background的用法

fixed表示固定定位;

相关文章:

  • 2021-08-09
  • 2021-07-12
  • 2022-12-23
  • 2022-12-23
  • 2021-07-03
  • 2021-11-09
  • 2022-12-23
猜你喜欢
  • 2021-08-11
  • 2022-12-23
  • 2021-07-15
  • 2022-12-23
  • 2021-07-01
  • 2021-08-07
相关资源
相似解决方案