background url为空

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/Lily_Song_8989/article/details/78426061

根据下边几个对比 来看下 url为空会如何??

1,BACKGROUND URL 有值,例如:

<div style="background: url('http://img.sj33.cn/uploads/allimg/201210/2012101121160089.jpg');font-size:20px;color:white;width:500px;height:500px;">BACKGROUND URL 有值</div>

这里写图片描述

2,BACKGROUND URL 为‘’,例如:

<div style="background: url('');font-size:20px;color:white;width:500px;height:500px;">BACKGROUND URL 有值</div>

这里写图片描述

这里当url内为空时,类似 background: url(”);background: url(); 只要有url时,浏览器就认为需要去访问下url里边的链接,为空的话就默认访问下当前url链接。

猜你喜欢

转载自blog.csdn.net/Lily_Song_8989/article/details/78426061