html - <sup> 在带下划线的元素中

标签 html css

我有一个带有样式下划线的元素。

在链接中有 TM 元素。

是否可以在所有单词的底部添加下划线,因为现在行中有一个中断,并且 sup 元素中的下划线更高。

感谢帮助

最佳答案

<u>This is some text for Brand Name&trade; to test the error.</u>

行得通。我无法重现您的错误。

编辑 好吧,我的错 - 我回答时没有使用 <sup>元素。如果您只是使用商标 (™) 标记,最好只使用 HTML 表达式,即 &trade; - 直接在您的文本中使用它。

关于您的问题,您确实有两个选择。

CSS

sup {
    padding-bottom: 4px;
    border-bottom: 1px solid black;
}

* 您可能需要调整 padding-bottom值取决于您的行高。

HTML

<u>This is a Brand</u><sup>for a company</sup><u> and then some more text</u>


或者,Lollero 的版本(修改为在线工作)...

CSS

div.underline { display: inline; padding-bottom: 1px; border-bottom: 1px solid #222; }

HTML

<div class="underline">what'<sup>s UP</sup></div>

关于html - <sup> 在带下划线的元素中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7468614/

相关文章:

javascript - 使用 Meteor 为每个模板动态加载 JS/CSS

jquery - 卡片翻转不适用于 safari

html - 相对于包装器 div HTML CSS 定位固定元素

php - 加号 ("+") 消失

jquery - ng-repeat 排序箭头在 javascript 数据表中不起作用

jquery、图像、选择器

html - 如何在基于 Ajax 的网站和基本 HTML 网站之间轻松切换?

css - 转换 - 当我将 html 内容转换为 pdf 时,旋转和缩放不起作用

javascript - 在电话和电子邮件输入框中显示正确的 fa fa 图标

选择的 CSS 宽度百分比比其他标签短