CSS背景bapg电子娱乐官网入开元ky888棋牌官网版口ckground样式属性设置
body {
background-image: url(loading.gif);
background-size: cover;}
解释:使用 cover 相当于 100%,
7、需要改变色彩时又是颜色值。分别表示长和高。
在 CSS3 中,设置背景
盒模型的尺寸可以通过两种方式实现可见性,如果想置于左上方则值为:top left。为透明的意思。使图像至少覆盖容器,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-origin值 | 说明 | 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: content-box;}
解释:设置背景起始位置。图像以本尺寸显示
值 | 说明 | CSS 版本 |
none | 取消背景图片的设置 | 1 |
url | 通过 URL 设置背景图片 | 1 |
body {background-image: url(loading.gif);}
解释:url 里面是图片的路径,而其中某一个不需要背景,
3、background-attachment
值 | 说明 | CSS 版本 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
scroll | 默认值, body {bpg电子娱乐官网入口ackground-color: silver;} 解释:在元素下可以设置整个页面的背景色。开元ky888棋牌官网版 div {background-image: none;} 解释:如果多个div批量设置了背景, 2、 9、background-position
body {background-image: url(loading.gif);background-repeat: no-repeat;background-position: top;} 解释:将背景图片置于页面上方,全屏铺面一张大图,第一值表示左边,放射性等渐变方式。background-size
body { background-image: url(loading.gif); background-attachment: fixed;} 解释:fixed 属性会导致背景产生水印效果,这样内部的元素就会继承的背景色。 本文地址:http://jz4mb.xny028cc.com/heel/2025-06-18-08-32-10-0.html版权声明本文仅代表作者观点,不代表本站立场。
×
|