css - 覆盖上标所需的垂直对齐但由表属性应用

标签 css html-table superscript

下面是我的代码:

<table border="0" cellspacing="1" cellpadding="0" width="100%">
<tr>
<td width="31%" align="center" valign="middle">
<a href="http://google.com/"></a> 
</td>
<td width="69%" valign="top">
Terms and conditions
<sup>#</sup>
</td>
</tr>
</table>

superscript 无效(# 不在顶部。它与条款和条件文本在同一行)。

我的猜测是 superscriptvertical-aligntable 属性覆盖。

以下是从 Web 开发人员那里获取的 table 属性的默认用法样式表。我还捕获了 sup。我没有看到它的值在 Web 开发人员中被删除。

tbody {
display: table-row-group;
vertical-align: middle;
border-color: inherit;
}

tr {
display: table-row;
vertical-align: inherit;
border-color: inherit;
}

td, th {
display: table-cell;
vertical-align: inherit;
}

td[Attributes Style] {
width: 31%;
text-align: -webkit-center;
vertical-align: middle;
}

sup {
vertical-align: super;
font-size: smaller;
}

如果我将 sup 放在 table 属性之外,它可以正常工作。如何让我的 suptable 中工作?

最佳答案

valign="top" 是原因。如果删除它,上标将起作用。

<td width="69%">
    Terms and conditions<sup>#</sup>
</td>

或者如果你想保持v-align,封装:

<td width="69%" valign="top">
    <span>Terms and conditions<sup>#</sup></span>
</td>

关于css - 覆盖上标所需的垂直对齐但由表属性应用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15566931/

相关文章:

html - 如果文本占用两行,如何使按钮中的文本垂直居中?

html - 使删除线更向下

html - 如何自动填充在 Fireworks 中创建的文本区域?

javascript - 从字符串 Javascript 中替换上标和下标字符

regex - 用纯数字替换 Unicode 数字下标或上标

css - bootstrap 词缀行高与导航不准确

javascript - 滚动时根据线性渐变背景设置适当的元素颜色

html - 如何给表格 td 添加边距

javascript - 使用Javascript控制表格单元格的内部文本

ios - UITextView 中的子/上标