gpt4 book ai didi

html - Firefox 和 IE8 中的 CSS 表格单元格填充问题

转载 作者:行者123 更新时间:2023-11-28 04:04:49 25 4
gpt4 key购买 nike

我在尝试调整表格布局时遇到了一些严重的问题。在 Firefox 中,我得到奇怪的顶部/底部填充与所有文本不一致。在 Firefox 和 IE8 中,我似乎也无法让我的图标在它们的单元格中显示为垂直居中。

见下图:

alt text http://www.graphicsdistrict.com/css-issue.png

这是我的表格 CSS:

table.maxwidth {
width: 100%;
}

table.standard th {
color: white;
font: bold 0.85em Century Gothic;
padding: 0.6em;
background-color: #424E4F;
}

table.standard td {
padding: 0.2em 0.5em;
}

table.standard tr + tr > td {
border-top: 1px dotted #ccc;
}

table.standard th + th {
border-left: 1px solid white;
}

table.standard td + td {
border-left: 1px dotted #ccc;
}

table.standard > tfoot > tr > td {
border-top: 0.18em solid #424E4F;
padding: 0.2em 0.5em;
}

table.striped tr.alt td {
background-color: #eee;
}

table.hover tr:hover td {
background-color: #e0e0e0;
}

这是我的表格 HTML:

<table class="standard maxwidth striped hover">

<thead>
<tr>
<th class="left">Accessory</th>
<th class="center">Available</th>
<th class="right">Options</th>
</tr>
</thead>

<tbody>

<tr>
<td class="label"><a href="/mss/Accessory/Edit/4">Mains Charger</a></td>
<td class="center">

<img src="/mss/Static/images/icons/tick.png" /></td>
<td class="right">
<a href="/mss/Accessory/Archive/4" onclick="if(!confirm('Are you sure you want to archive this Accessory?')) return false;">Archive</a>
/ <a href="/mss/Accessory/Delete/4" onclick="if(!confirm('Are you sure you want to delete this Accessory?\nRelated historical data and reports will be affected!')) return false;">Delete</a>

</td>
</tr>

<tr>
<td class="label"><a href="/mss/Accessory/Edit/3">Bluetooth Headset</a></td>
<td class="center">

<img src="/mss/Static/images/icons/tick.png" /></td>
<td class="right">
<a href="/mss/Accessory/Archive/3" onclick="if(!confirm('Are you sure you want to archive this Accessory?')) return false;">Archive</a>

/ <a href="/mss/Accessory/Delete/3" onclick="if(!confirm('Are you sure you want to delete this Accessory?\nRelated historical data and reports will be affected!')) return false;">Delete</a>
</td>
</tr>

<tr>
<td class="label"><a href="/mss/Accessory/Edit/2">Car Kit</a></td>
<td class="center">

<img src="/mss/Static/images/icons/tick.png" /></td>

<td class="right">
<a href="/mss/Accessory/Archive/2" onclick="if(!confirm('Are you sure you want to archive this Accessory?')) return false;">Archive</a>
/ <a href="/mss/Accessory/Delete/2" onclick="if(!confirm('Are you sure you want to delete this Accessory?\nRelated historical data and reports will be affected!')) return false;">Delete</a>
</td>
</tr>

<tr>
<td class="label"><a href="/mss/Accessory/Edit/1">Leather Phone Case</a></td>

<td class="center">

<img src="/mss/Static/images/icons/tick.png" /></td>
<td class="right">
<a href="/mss/Accessory/Archive/1" onclick="if(!confirm('Are you sure you want to archive this Accessory?')) return false;">Archive</a>
/ <a href="/mss/Accessory/Delete/1" onclick="if(!confirm('Are you sure you want to delete this Accessory?\nRelated historical data and reports will be affected!')) return false;">Delete</a>
</td>
</tr>


</tbody>
<tfoot>
<tr>
<td colspan="3"><a href="/mss/Accessory/New">Add an Accessory</a></td>
</tr>
</tfoot>
</table>

请注意,单元格内容之前和/或之后的间距似乎不会对问题产生正面或负面影响。

编辑

将 CSS 更改为使用 px 单位而不是 em 修复了左列文本的慢跑,但没有解决垂直图像居中问题。想法?

编辑 2

现在有一个问题的演示 online here .

最佳答案

图像是vertically aligned在基线上为后裔留出空间 - 以防万一您添加文本。垂直对齐底部,多余的空间消失。

td img {vertical-align:bottom;}

关于html - Firefox 和 IE8 中的 CSS 表格单元格填充问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1130482/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com