gpt4 book ai didi

html - 如何使用 css 在 html 50% 50% 的表格中制作两行?

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

我希望我的表中的 2 行相等。第一个宽度为 50%,第二个宽度为 50%。现在第一行较小,因为其中的文本较少。

我需要网站上的表格完全 100% 宽度,然后左右行应该相等。我希望你明白我的意思。

这是我的代码:

<!DOCTYPE html>
<html>

<head>
<style>
table {
width: 100%;
}

td,
th {
text-align: left;
}

.awesome {
text-align: right;
padding-right: 20px;
vertical-align: top;
padding-top: 20px;
}

#prostorzaobrazec {
vertical-align: top;
padding-top: 20px;
}
</style>
</head>

<body>

<table>
<tr>
<th id="left">Some text</th>
<th></th>


<th id="right">Some textSome textSome textSome textSome textSome textSome textSome textSome textSome textSome textSome textSome textSome textSome text</th>
<th></th>

</tr>

</table>
</body>

</html>

最佳答案

我不确定你的意思,但我从你的问题中得到的想法是这样的:

http://jsfiddle.net/9ymdj6gw/5/

<!DOCTYPE html>
<html>

<head>
<style>
table {
width: 100%;
}

td,
th {
text-align: left;
width:50%;
border:1px solid black;
}

.awesome {
text-align: right;
padding-right: 20px;
vertical-align: top;
padding-top: 20px;
}

#prostorzaobrazec {
vertical-align: top;
padding-top: 20px;
}
</style>
</head>

<body>

<table>
<tr>
<th id="left">Some text</th>


<th id="right">Some textSome textSome textSome textSome textSome textSome textSome textSome textSome textSome textSome textSome textSome textSome text</th>

</tr>

</table>
</body>

</html>

注意:您有 4 <th>在您的脚本中,因此一个原始值中有 4 个值。

关于html - 如何使用 css 在 html 50% 50% 的表格中制作两行?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51291461/

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