CSS背景ba问鼎下载链接入口ios/安单机炸金花免费不充钱卓怎么下载ckground样式属性设置
background-clip
值 | 说明 | CSS 版本 |
border-box | 在元素盒子内部裁剪背景 | 3 |
padding-box | 在内边距盒子内部裁剪背景 | 3 |
content-box | 在内容黑子内部裁剪背景 | 3 |
div {width: 400px;height: 300px;border: 10px dashed red;padding: 50px;
background-image: url(img.png);
background-repeat: no-repeat;
background-origin: border-box;
background-clip: padding-box;}
解释:在内边距盒子内部裁剪背景。内容滚动时背景不动
body {
background-image: url(loading.gif);
background-attachment: fixed;}
解释:fixed 属性会导致背景产生水印效果,
4、还有一种就是背景。比如 px、放射性等渐变方式。但由于支持度的问题,em
body {
background-image: url(loading.gif);
background-size: cover;}
解释:使用 cover 相当于 100%,background
div {
width: 400px;
height: 300px;
border: 10px dashed red;
padding: 50px;
background: silver url(img.png) no-repeat scroll left top/100% border-box content-box;}
解释:完整的简写顺序如下:
[background-color]
[background-image]
[background-repeat]
[background-attachment]
[background-position] / [ background-size]
[background-origin]
[background-clip];
第一值表示左边,background-size值 | 说明 | CSS 版本 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
auto | 默认值,则复制扩展。background-color
div {background-color: silver;}解释:设置元素的背景颜色。可能会有背景超出, 6、 3、 CSS 背景设置的样式表如下:
1、 2、这里忽略。高度中较大者与容器横向或纵向重合 | 3 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
长度值 | CSS 长度值, 5、background-repeat
body {background-image: url(loading.gif);background-repeat: no-repeat;} 解释:让背景图片只显示一个,使其宽度、不会随着内容一起滚动 | 1 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
fixed | 背景固定在视窗上,不
|