首页 > 解决方案 > 从链接的一部分中删除下划线

问题描述

我在它之前有一些内容超链接。和图片一样。

在此处输入图像描述

这是我正在使用的代码。

a {


font-size: 14px;
  text-decoration: none;
  color: $grey;
  font-weight: bold;
  text-decoration: underline;
  &:hover {
    cursor: pointer;
  }

  &:before {
    content: '\1F847';
    color: $green;
    padding-right: 8px;
    text-decoration: none;
  }

  &:after {
    text-decoration: none;
  }
}

我需要作为内容添加的箭头没有下划线作为文本装饰,但文本需要保留它。如您所见,我尝试添加text-underline:none之前和之后,但它没有工作。如果需要,我可以使用 JS/Query,但仍然不知道该怎么做。

标签: htmlcsssasshyperlink

解决方案


更改:before伪元素,使其显示为inline-block

  &:before {
    content: '\1F847';
    color: $green;
    padding-right: 8px;
    text-decoration: none;
    display: inline-block;
  }

推荐阅读