html - 覆盖 li 元素的用户代理样式
问题描述
我有以下html。
<div class="alert alert-error" role="alert">
<ul>
<li>This is test message.</li>
</ul>
</div>
我正在使用引导警报。警报样式在自定义 css 中被覆盖以ban-circle
在警报消息之前添加。
.alert {
padding: 5px;
margin-bottom: 5px;
color: white;
}
.alert-error {
background-color: rgb(186, 39, 39);
}
/*Using a Bootstrap glyphicon as ban-circle*/
.alert-error li:before {
content: "\e090";
font-family: 'Glyphicons Halflings';
padding-right: 5px;
}
UI 在警报消息之前显示禁止圆圈,但它也在禁止圆圈之前显示点。该点来自用户代理样式表。我<!DOCTYPE html>
按照这个SO的建议
如何摆脱用户代理样式中的点?
解决方案
您可以使用 CSS 值为 none 的 list-style-type 属性来消除点。您可以在此处进一步了解该物业。
我在以下代码中使用了它:
.alert {
padding: 5px;
margin-bottom: 5px;
color: white;
}
.alert-error {
background-color: rgb(186, 39, 39);
}
/*Using a Bootstrap glyphicon as ban-circle*/
.alert-error li:before {
content: "\e090";
font-family: 'Glyphicons Halflings';
padding-right: 5px;
}
ul {
list-style-type: none;
}
<!DOCTYPE html>
<html lang="en">
<head>
<!-- Required meta tags -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<link rel="stylesheet" href="./style.css">
<title>Hello, world!</title>
</head>
<body>
<div class="alert alert-error" role="alert">
<ul>
<li>This is test message.</li>
</ul>
</div>
</body>
</html>
推荐阅读
- c# - ASP.NET Web API - System.Threading.Tasks.TaskCanceledException:任务被取消的困境
- apache-spark - 如何从 PySpark 中的过滤范围对象中获取值
- python-2.7 - Python:logging.error(traceback.format_exception)的问题
- dns - 子域和@记录
- c++ - 从 Windows、Linux 和 Mac 上的字体文件中读取字体名称?
- javascript - 动态字符串匹配
- android - V7 的清单合并失败
- google-api - 为不同国家的公司网站创建一个或多个 OAuth 2.0 项目?(URL 和本地内容中的不同前缀)
- sql - 自加入的替代方案
- tensorflow - 可以动态指定 Keras RepeatVector 重复吗?