我的 h4 旁边有一个跨度,看起来像这样。
我想在我的跨度顶部堆叠一个白色的右尖括号。
HTML
<h4 class="pp">
<span class="cr"></span>
Laptop
</h4>
CSS
.cr {
position: relative;
display: inline-block;
background-color: #ff7c00;
border-radius: .25em;
width: 1.3em;
height: 1.3em;
float: left;
margin-right: .5em;
}
我试过了
<h4 class="pp">
<span class="cr"></span>
<span>></span>
Laptop
</h4>
我得到了
人们会怎么做呢?
最佳答案
这是您要找的吗?它在技术上位于盒子内部而不是顶部,但我认为这就是您想要实现的,不是吗?
.cr {
position: relative;
display: inline-block;
background-color: #ff7c00;
border-radius: .25em;
width: 1.3em;
height: 1.3em;
float: left;
margin-right: .5em;
text-align: center;
color: white;
}
<h4 class="pp">
<span class="cr"> > </span>
Laptop
</h4>
关于html - 在跨度上添加一个字符,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48815014/