美文网首页
css background属性

css background属性

作者: 大猫_197c | 来源:发表于2017-08-31 14:55 被阅读0次

背景图占据padding的内容,可以使用background-clip在调整

background-color 使用的背景颜色。

background-image 使用的背景图像。

background-repeat 如何重复背景图像。

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

background-position 背景图像的位置。

css3新增

background-size 背景图片的尺寸。可以指定背景图的大小,例如20%  60px;

background-origin 背景图片的定位区域。

background-clip 背景的绘制区域。

background: [background-color] [background-image] [background-repeat] [background-attachment] [background-position] / [ background-size] [background-origin] [background-clip];

background: aquamarine

url(img.png)

no-repeat

scroll

center center / 50%

content-box content-box;

background-size 属性

一:length

该属性值是设置背景图像的宽度和高度的,第一个值是宽度,第二个值是设置高度的。如果只设置第一个值,那么第二个值会自动转换为 “auto”;

二:percentage

该属性是以父元素的百分比来设置图片的宽度和高度的,第一个值是宽度,第二个值是高度。如果只设置一个值,那么第二个值会被设置为 “auto”;

三:cover

把背景图像扩展至足够大,以使背景图像完全覆盖背景区域。

四:contain

把图像扩展至最大尺寸,以使宽度和高度 完全适应内容区域。

相关文章

  • CSS3 背景

    CSS3 背景 CSS3 background-origin 属性 background-origin 属性规定背...

  • CSS属性参考手册

    CSS3 动画属性(Animation) CSS 背景属性(Background) CSS 边框属性(Border...

  • CSS -- background

    background 属性用来设置元素的背景 CSS1 中的background属性链接: background-...

  • css background的多种属性详解

    css的background属性由以下属性组成: background-color:背景色 background-...

  • CSS3背景

    CSS3 background-size 属性 background-size 属性规定背景图片的尺寸。在 CSS...

  • Tailwind Background

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

  • CSS3背景裁切属性——background-clip

    CSS中的background属性想必大家已经用了无数遍,但是对于CSS3属性background-clip你可能...

  • CSS基本属性

    CSS基本属性 背景属性 background-color background-imageURL()插入图片链接...

  • 前端开发学习第二十六天

    1.background-image属性 在css中,background-image属性是控制元素的必选属性,它...

  • CSS背景图

    css背景图 涉及的css属性 background-image background-repeat 默认情况下,...

网友评论

      本文标题:css background属性

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