gpt4 book ai didi

html、表格和间距问题

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

我想制作一个外观与 Windows 8 磁贴类似的 html 页面。然而,我一直坚持制作最基本的东西......表格

我基本上想制作一个覆盖整个屏幕的表格,它们之间有一定的间距,并以渐变作为表格的背景。无论如何,在我看来,代码并没有在听我说什么。

我说我希望单元格的高度是某个特定的百分比值,但它并没有这样做。此外,我希望所有单元格的大小都相同(例如,渐变背景是相等的)并且不依赖于其中的文本量。

这是一堵代码墙...

<!DOCTYPE html>
<html>

<head>
<style>

html, body
{
height: 100%;
width: 100%;
}

table {
width:100%;
height:100%;
border-spacing: 10px;
border-collapse: separate;
}

tr {
width:25%
}

td {
height:16%
}

#brightgreen_tile {
background-image: -webkit-gradient(
linear,
left bottom,
left bottom,
color-stop(0, #17E35F),
color-stop(0.84, #8CFFB4)
);
background-image: -o-linear-gradient(left bottom, #17E35F 0%, #8CFFB4 84%);
background-image: -moz-linear-gradient(left bottom, #17E35F 0%, #8CFFB4 84%);
background-image: -webkit-linear-gradient(left bottom, #17E35F 0%, #8CFFB4 84%);
background-image: -ms-linear-gradient(left bottom, #17E35F 0%, #8CFFB4 84%);
background-image: linear-gradient(to left bottom, #17E35F 0%, #8CFFB4 84%);
}
</style>
</head>


<body bgcolor="#E6E6FA">

<table>
<tr>
<td align="center">
<div id="brightgreen_tile">
<font size="6">shizzle</font> </br>
</div>
</td>

<td align="center">
<div id="brightgreen_tile">
<font size="6">shizzle</font> </br>
</div>
</td>

<td align="center">
<div id="brightgreen_tile">
<font size="6">shizzle</font> </br>
</div>
</td>

<td align="center">
<div id="brightgreen_tile">
<font size="6">shizzle</font> </br>
</div>
</td>

<td align="center">
<div id="brightgreen_tile">
<font size="6">shizzle</font> </br>
</div>
</td>

<td align="center">
<div id="brightgreen_tile">
<font size="6">shizzl1</font> </br>
</div>
</td>
</tr>

<tr>
<td align="center">
<div id="brightgreen_tile">
<font size="6">shizzl1</font> </br>
</div>
</td>

<td align="center">
<div id="brightgreen_tile">
<font size="6">shizzle</font> </br>
</div>
</td>

<td align="center">
<div id="brightgreen_tile">
<font size="6">shizzle</font> </br>
</div>
</td>

<td align="center">
<div id="brightgreen_tile">
<font size="6">shizzle</font> </br>
</div>
</td>

<td align="center">
<div id="brightgreen_tile">
<font size="6">shizzle</font> </br>
</div>
</td>

<td align="center">
<div id="brightgreen_tile">
<font size="6">shizzle</font> </br>
</div>
</td>
</tr>

<tr>
<td align="center">
<div id="brightgreen_tile">
<font size="6">shizzle</font> </br>
</div>
</td>

<td align="center">
<div id="brightgreen_tile">
<font size="6">shizzle</font> </br>
</div>
</td>

<td align="center">
<div id="brightgreen_tile">
<font size="6">shizzle</font> </br>
</div>
</td>

<td align="center">
<div id="brightgreen_tile">
<font size="6">shizzle</font> </br>
</div>
</td>

<td align="center">
<div id="brightgreen_tile">
<font size="6">shizzle</font> </br>
</div>
</td>

<td align="center">
<div id="brightgreen_tile">
<font size="6">shizzle</font> </br>
</div>
</td>
</tr>

<tr>
<td align="center">
<div id="brightgreen_tile">
<font size="6">shizzle</font> </br>
</div>
</td>

<td align="center">
<div id="brightgreen_tile">
<font size="6">shizzle</font> </br>
</div>
</td>

<td align="center">
<div id="brightgreen_tile">
<font size="6">shizzle</font> </br>
</div>
</td>

<td align="center">
<div id="brightgreen_tile">
<font size="6">shizzle</font> </br>
</div>
</td>

<td align="center">
<div id="brightgreen_tile">
<font size="6">shizzle</font> </br>
</div>
</td>

<td align="center">
<div id="brightgreen_tile">
<font size="6">shizzle</font> </br>
</div>
</td>
</tr>
</table>

</body>
</html>

最佳答案

html 中有很多问题。但 OP 的答案是从 TR 中删除 25%,并将 height:100% 添加到 #brightgreen_tile。它应该是类而不是 ID。

#brightgreen_tile {
height:100%;
background-image: -webkit-gradient(linear, left bottom, left bottom, color-stop(0, #17E35F), color-stop(0.84, #8CFFB4));
background-image: -o-linear-gradient(left bottom, #17E35F 0%, #8CFFB4 84%);
background-image: -moz-linear-gradient(left bottom, #17E35F 0%, #8CFFB4 84%);
background-image: -webkit-linear-gradient(left bottom, #17E35F 0%, #8CFFB4 84%);
background-image: -ms-linear-gradient(left bottom, #17E35F 0%, #8CFFB4 84%);
background-image: linear-gradient(to left bottom, #17E35F 0%, #8CFFB4 84%);
}

这是 Fiddle

关于html、表格和间距问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24090884/

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