简体   繁体   English

定位标记中的上标无法正常工作

[英]Superscript in anchor tag is not working properly

I have a link and a superscript in the link name. 我有一个链接,链接名称中有一个上标。 I get the superscript but it moved top with the underline as it is a link. 我得到了上标,但是它是带有链接的,因此带有下划线的位置移至顶部。 i am trying to keep the underline in the place with the title and just raise the superscript only but running out of ideas. 我试图将下划线保持在标题的位置,并且只提出上标,但想法不多。

i tried one trick but it works only in google chrome. 我尝试了一个技巧,但它仅适用于Google Chrome。

here is my code 这是我的代码

   <A href="http://www.google.com/" target=_blank>Google<SUP style="BORDER-BOTTOM: white 1px solid; COLOR: white !important">®</SUP> search</A>

here is jsfiddle link https://jsfiddle.net/f582kmsj/ 这是jsfiddle链接https://jsfiddle.net/f582kmsj/

remove border from the sup element and add this to your styles: 从sup元素中删除边框并将其添加到您的样式中:

a {
  text-decoration: none;
  border-bottom: 1px solid;
}

By not specifying a color on the border, it will always match the color of the text and more-or-less mimic the default underline. 通过不在边框上指定颜色,它将始终与文本的颜色匹配,并且或多或少地模仿了默认的下划线。

If you want to use inline styles, this will give you a single continuous underline: 如果要使用内联样式,这将为您提供一个连续的下划线:

<a href="http://www.google.com/" target="_blank">Google<sup style="display: inline-block; border-bottom: 1px solid; padding-bottom: 4px">®</sup> search</a>

Or as a CSS declaration: 或作为CSS声明:

a > sup {
  display: inline-block; 
  border-bottom: 1px solid; 
  padding-bottom: 4px
}

You may need to adjust the bottom padding according to your text size. 您可能需要根据文本大小调整底部填充。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM