html - 使用 HTML 字符作为背景
问题描述
我已经按照这个答案将这个 html 字符作为背景图像。它工作得很好,但不能作为背景,HTML 字符位于文本之上。我已经尝试了几种可能性,但我认为有些东西超出了我的知识范围。
.number {position: relative;
font-family: sans-serif;
font-size: 18px;
font-weight: bold;
color: red;
}
.number::after {
content: "\2617";
color: blue;
margin-left: -1em;
font-size:30px;
}
<div class="number">
90
</div>
解决方案
使用z-index
属性:
.background {
position: absolute;
z-index: -9999;
}
推荐阅读
- android - (已解决)Android Studio:底部导航视图未在我的菜单中显示项目,稍后添加
- javascript - 如何将 UIWebView 中的 JSContext 重新用于 WKWebview 的 WKScriptMessage
- javascript - How to a count a specific digit in a number with javascript
- java - Quartz 是否支持在多个节点上执行一次?
- c++ - 阅读使用 C++ 以 little endian 编写的 Oracle BLOB
- python - 在从传感器读取而不打印从传感器读取的数据时,循环不能立即工作?
- java - 如何使日志仅在文件上打印而不在控制台上打印?
- keycloak - Keycloak 失败,因为它找不到我的主题或带有 NullPointer 异常的默认主题
- ngrx - 如何为 ngrx/data 编写选择器?
- python - 在 OpenWrt Linux 的单独分区上,在启动/重启时运行 Python 程序