gpt4 book ai didi

html - 嵌入式 html 样式不影响表格?

转载 作者:太空宇宙 更新时间:2023-11-04 15:51:02 25 4
gpt4 key购买 nike

我正在尝试使用样式来影响我的 html 表格中单元格的间距。我正在尝试使用边距使我的单元格仅在右侧有间距。我做错了什么以及如何使用样式来影响单元格间距?

<html>
<head>
<meta http-equiv="content-type" content="text/html;charset=ISO-8859-1">

<style>
body {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 9pt;
}

table {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 9pt;
}

td {
margin: 0px 20px 0px 0px;
color: #585858;
}

a {
color: #326ea1;
}
</style>

<title>Request</title>
</head>
<body>

<table border="0" cellpadding="0" cellspacing="0">
<tbody>
<tr>
<td> Request ID </td>
<td>516<br>
</td>
</tr>
<tr>
<td>Assigned<br>
</td>
<td>Fred Flintstone<br>
</td>
</tr>
<tr>
<td>Requestor<br>
</td>
<td>Bugs Bunny<br>
</td>
</tr>
<tr>
<td>Type<br>
</td>
<td>Construction<br>
</td>
</tr>
<tr>
<td>Location<br>
</td>
<td>Brazil<br>
</td>
</tr>
<tr>
<td> <br>
</td>
<td> <br>
</td>
</tr>
<tr>
<td style=" vertical-align: top;">Description</td>
<td>Lorem ipsum dolor sit amet, consectetur adipisicing elit, <br>
sed do eiusmod tempor incididunt ut labore et dolore <br>
magna aliqua. Ut enim ad minim veniam, quis nostrud <br>
exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
</td>
</tr>
<tr>
<td><br>
</td>
<td><br>
</td>
</tr>
</tbody>
</table>

</body>
</html>

最佳答案

不幸的是,表格单元格没有边距属性,但您可以在它们上设置填充以获得所需的行为。 W3Schools 的样式表页面可能对您有所帮助:http://www.w3schools.com/css/css_table.asp

如果您将代码更改为以下内容,它应该可以工作:

td {
padding: 0px 20px 0px 0px;
color: #585858;
}

您还可以在表格上设置 cellspacing 属性。这将在单元格边界之间放置空间 - 但是,这会影响单元格所有边的间距。

关于html - 嵌入式 html 样式不影响表格?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11209060/

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