html - 背景徽标未加载
问题描述
它没有显示我想用作我自己的徽标的图片。
这是一个演示:
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>
解决方案
尝试给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>
推荐阅读
- python - 重新排列结果编号升序
- c# - 如何在 ReactiveUI 9.3.5 中全局处理异常?
- django - 需要在 Django 管理界面上显示用户计数其他数据计数
- xml - XML 语法检查 DTD 文件时发生错误
- xamarin - 从 Xamarin 跨平台连接到 Oracle 数据库
- c# - 在 Xamarin 表单和 ASP.NET MVC 5 (.NET 4.6.1) 项目之间共享代码
- java - 带有完整构造函数调用的方法引用作为 Java 中的 lambda 表达式
- c++ - 使用 set 方法时,protobuf 成员的地址会改变吗?
- macos - mac mini 进入睡眠状态后如何让 ngrok 保持活力
- c - 如何在 Windows 10 上安装 dr memory