css中background和 background-color 同时使用的优先级

给背景图片设置一个默认背景颜色,有以下两种方法:

<style>
  .bg1{
  background:url(http://debug.itxst.com/img/logo.png) red no-repeat; 
    height:80px;width:1000%;
  }
  
    .bg2{
  background:url(http://debug.itxst.com/img/logo.png) no-repeat; 
    height:80px;width:1000%;
    background-color:red;
  }
  
</style>

<div class="bg1">

</div>

<div class="bg2">

</div>

 转载  http://www.itxst.com/detail/jnjvv2qu.html

猜你喜欢

转载自www.cnblogs.com/logspool/p/10847251.html