盒子背景web
盒子背景:content padding 特殊的 boder 背景url
背景绘制 从 padding 开始绘制spa
特殊: 在指定文字背景时 -webkit-background-clip: text;code
#box { width: 300px; height: 300px; bakground-image: url(./img/a.jpg); /* width height 若是只写一个值,第二个值根据宽高比自动计算*/ background-size: 100px 100px; }
#box { width: 300px; height: 300px; bakground-image: url(./img/a.jpg); /* 参照于盒子自身的 width height 若是只写一个值,第二个值根据宽高比自动计算*/ background-size: 100% 100%;
background-size: 20%; }
#box { width: 300px; height: 200px; bakground-image: url(./img/a.jpg); /* 拉伸效果: 根据最远边进行伸缩调节 */ background-size: cover; }
#box { width: 300px; height: 200px; bakground-image: url(./img/a.jpg); /* 拉伸效果: 根据最近边进行伸缩调节 */ background-size: contain; }
#box { width: 300px; height: 200px; background-repeat: no-repeat; background-image: url("img/niu.png") , url("img/cao_bg.png") ; }
#bg { width: height: 480px; overflow: hidden; /* 隐藏模糊溢出 */ } #bg img { width: 320px; height: 480px filter: blur(5px); } #content { position: absolute; top: 0px; left: 0px; width: 320px; height: 480px; }