css - 划掉文本 CSS

标签 css text

enter image description here

我需要为网站划掉此文本,如图所示。有谁知道如何做到这一点?

最佳答案

您可以使用 :before:after 伪元素来创建线条和 transform:rotate()

div {
  font-size: 35px;
  color: #aaa;
  position: relative;
  display: inline-block;
}
sup {
  font-size: 20px;
}
div:after,
div:before {
  position: absolute;
  content: '';
  top: 50%;
  left: 0;
  width: 100%;
  height: 2px;
  background: black;
}
div:before {
  transform: rotate(20deg);
}
div:after {
  transform: rotate(-20deg);
}
<div>$345<sup>.87</sup>
</div>

关于css - 划掉文本 CSS,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40081927/

相关文章:

python - 类型错误 : Mismatch between array dtype ('object' ) and format specifier ('%.18e' )

python - 使用 Python 从文本文件中提取数据

Python每分钟读取txt文件600x-1200x的后果

c# - ASP.NET 网站在 IE10 上看起来不同

css - top : auto; bamboozles me 的行为

html - 水平对齐图像 CSS

Java新手: infinite loop searching for specific text in a file

css - Sharre 社交媒体插件样式问题

jquery - 如何选择特定 id 下的特定类?

linux - 快速 unix 命令在文件中间显示特定行?