gpt4 book ai didi

html - 如何为表格标题添加底部框阴影

转载 作者:行者123 更新时间:2023-12-04 09:29:58 31 4
gpt4 key购买 nike

我正在尝试为表格标题添加底部框阴影,但由于某种原因,阴影也出现在两侧。下面是我正在尝试的代码。

#customers {
font-family: "Trebuchet MS", Arial, Helvetica, sans-serif;
border-collapse: collapse;
width: 100%;
}

#customers td,
#customers th {
padding: 8px;
}

#customers th {
box-shadow: 0 1px 2px 0px grey;
}
<table id="customers">
<tr>
<th>Company</th>
<th>Contact</th>
<th>Country</th>
</tr>
<tr>
<td>Alfreds Futterkiste</td>
<td>Maria Anders</td>
<td>Germany</td>
</tr>
<tr>
<td>Berglunds snabbköp</td>
<td>Christina Berglund</td>
<td>Sweden</td>
</tr>
<tr>
<td>Centro comercial Moctezuma</td>
<td>Francisco Chang</td>
<td>Mexico</td>
</tr>
</table>

我正在寻找的是带有 blur:2px 的盒子阴影, spread:0px , y-offset:1pxx-offset:0px

最佳答案

猜猜这可能是您要找的东西 我在 box-shadow 上做了一些编辑我将表格数据居中 td和 table 头th为了让它的外观好看

#customers {
font-family: "Trebuchet MS", Arial, Helvetica, sans-serif;
border-collapse: collapse;
width: 100%;
}

#customers td,
#customers th {
padding: 8px;
/* added */
text-align: center;
}

#customers th {
/* edited */
box-shadow: 0px 2px 0px rgba(128,128,128, .15);
}
<table id="customers">
<tr>
<th>Company</th>
<th>Contact</th>
<th>Country</th>
</tr>
<tr>
<td>Alfreds Futterkiste</td>
<td>Maria Anders</td>
<td>Germany</td>
</tr>
<tr>
<td>Berglunds snabbköp</td>
<td>Christina Berglund</td>
<td>Sweden</td>
</tr>
<tr>
<td>Centro comercial Moctezuma</td>
<td>Francisco Chang</td>
<td>Mexico</td>
</tr>
</table>

关于html - 如何为表格标题添加底部框阴影,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62886553/

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