以前我可以通過以下規則在hr
元素之前和之後添加內容。但它現在不工作!你能否讓我知道是什麼導致了這個問題?關於將內容添加到hr元素之後的問題
.hr-title:before {
content: "";
width: 16px;
height: 24px !important;
background-color: gold;
position: absolute;
top: -7px;
left: -1px;
}
.hr-title {
position: relative;
height: 1px;
background-color: #d0d0d0;
color: #ccc;
border-top: 1px solid #ccc;
margin: 0 auto;
margin-top: -12px;
margin-bottom: 30px;
width: 50%;
}
.hr-title:after {
content: "";
width: 4px;
height: 14px;
background-color: #24A2C6;
position: absolute;
top: -7px;
right: -1px;
}
<h2> Test </h2>
<hr class="hr-title">