css3中的背景图片问题
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | <!DOCTYPE html> < html > < head > < meta charset = "UTF-8" > < title >background-origin</ title > </ head > < style type = "text/css" > div{ margin: 0 auto; width: 300px; height: 100px; border: 10px rgba(0, 0, 255,0.2) solid; padding: 10px; background: url(http://img1.sycdn.imooc.com/climg//582c342b0001fd6507000210.jpg) no-repeat; background-clip: content-box; } </ style > < body > < div ></ div > </ body > </ html > |
为什么上和左边框没有被背景图片覆盖?
0
收起
正在回答
3回答
同学如果想要实现边框覆盖图片,则需要设置如下:
希望可以帮到你!
weixin_慕的地5241954
2019-08-23 23:03:22
background-clip: content-box;这里写错了,是background-clip: border-box;
恭喜解决一个难题,获得1积分~
来为老师/同学的回答评分吧