html - 在跨度上添加一个字符

标签 html css

我的 h4 旁边有一个跨度,看起来像这样。

enter image description here

我想在我的跨度顶部堆叠一个白色的右尖括号。

enter image description here

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>

我得到了

enter image description here

人们会怎么做呢?

最佳答案

这是您要找的吗?它在技术上位于盒子内部而不是顶部,但我认为这就是您想要实现的,不是吗?

.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/

相关文章:

html - 为什么我的 Child Div 忽略它的父级?

css - 填充 Bootstrap 中的可用空间

css - 文本溢出 : ellipsis inside flexible height div inside a div with a limited height

php - 对动态添加的元素所做的更改会自动恢复

jquery - 淡入淡出效果在我悬停时不断重复

javascript - 在 EaselJs 中创建橡皮擦 - 下一步

javascript - 如何根据主题标签更改事件链接的 CSS

twitter-bootstrap - Bootstrap 4 - 如何将自动宽度设置为中央内联或 flex 元素?

css - :empty pseudo class issue with added/removed content and sibling combinators

jquery - 更新 100% 宽度元素的大小