css设置hr颜色
行内样式
<body>
<hr style="border: 0; background-color: red; height: 1px; ">//行内式改变hr颜色
</body>
注意
<body>
<hr style="background-color:red;">//直接设置颜色没有效果
<hr style="border: 0; background-color: red;">//不加height: 1px;的话,一般hr不会显示
<hr style=" background-color: red; height: 1px; ">//不加border: 0;的话,虽然颜色会改变,但是会显示一条黑色边框
</body>
内部样式
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport"
content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
<style>
.hr{
border: 0;
background-color: red;
height: 1px;
}
</style>
</head>
<body>
<hr class="hr">
</body>
</html>