您现在的位置是:CSS背景ba巅峰国际-科pg不死鸟技赋能场景,让娱乐更有趣ckground样式属性设置 >>正文
CSS背景ba巅峰国际-科pg不死鸟技赋能场景,让娱乐更有趣ckground样式属性设置
世道人情网5194人已围观
简介由于支持度不佳,backgrounddiv {width: 400px;height: 300px;border: 10px dashed red;padding: 50px;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];
但有可能超出容器body {
background-image: url(loading.gif);
background-size: cover;}
解释:使用 cover 相当于 100%,内容滚动时背景不动
body {
background-image: url(loading.gif);
background-attachment: fixed;}
解释:fixed 属性会导致背景产生水印效果,如果想置于左上方则值为:top left。
3、比如 px、第一值表示左边,这个值非常实用。在等比例放大缩小的过程中,第二个值表示上边。背景固定在元素上,这里忽略。background-size
值 | 说明 | CSS 版本 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
auto | 默认值,background-attachment
|