首页 > 解决方案 > 背景徽标未加载

问题描述

它没有显示我想用作我自己的徽标的图片。

这是一个演示:

body {
    background: rgb(211, 101, 101);
}
.logo{
    text-indent: -999999px;
    background: url('https://via.placeholder.com/250/333/fff/?text=Background%20Image');
}
<div class="logo"></div>

标签: htmlcss

解决方案


尝试给logo类一个width 和 height

背景图像是背景图像,如果没有内容,则没有宽度或高度来显示图像。

.logo{
   width: 200px;
   height: 200px;
   text-indent: -999999px;
   background: url('logo.png');
}

看演示..

body {
    background: rgb(211, 101, 101);
}
.logo{
   width: 200px;
   height: 200px;
   text-indent: -999999px;
   background: url('logo.png');
   background: url('https://i.stack.imgur.com/18mpK.png') no-repeat;
}
<body>
  <div class="logo"></div>
</body>


推荐阅读