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

posted @ 2019-05-10 23:26  logspool  阅读(1783)  评论(1编辑  收藏  举报