gpt4 book ai didi

javascript - 当 "justify"的文本开始推送表格时,我如何 `th` 文本?

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

th 的文本开始插入表格使其变得比原始大小更大时,我如何调整它的文本

当表格不能再挤压另一个单元格时,我想让表格“断线”(又名对齐)。

原文:

original

现在发生了什么(问题): problem

应该如何:(不是增加宽度,而是增加高度,并保留整个文本) should be

<!DOCTYPE html>
<html>
<head>
<title>My_Littlest_Table_Shop</title>
<style>
table{
width: 200px;
height: 100px;
}

table, th, td{
border: 1px solid black;
}
</style>
</head>
<body>
<table>
<thead>
<tr>
<th class="header" align="center">idkajsdhfkjhaksdfhkjashfkjaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaksdfjjjjjj</th>
<th class="header" align="center">id</th>
</tr>
</thead>
<tbody>
<tr>
<td class="header" align="center">id</td>
<td class="header" align="center">id</td>
</tr>
</tbody>
</table>
<div>----------------200px--------------></div>
</body>
</html>

最佳答案

这些人应该做到这一点:

table { 
table-layout: fixed;
}
th, td {
/* not sure if you want this
width: 100px; */
word-wrap: break-word;
}

<!DOCTYPE html>
<html>
<head>
<title>My_Littlest_Table_Shop</title>
<style>
table{
width: 200px;
height: 100px;
}

table, th, td{
border: 1px solid black;
}

table {
table-layout: fixed;
}
th, td {
/* not sure if you want this
width: 100px; */

word-wrap: break-word;
}
</style>
</head>
<body>
<table>
<thead>
<tr>
<th class="header" align="center">idkajsdhfkjhaksdfhkjashfkjaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaksdfjjjjjj</th>
<th class="header" align="center">id</th>
</tr>
</thead>
<tbody>
<tr>
<td class="header" align="center">id</td>
<td class="header" align="center">id</td>
</tr>
</tbody>
</table>
<div>----------------200px--------------></div>
</body>
</html>

关于javascript - 当 "justify"的文本开始推送表格时,我如何 `th` 文本?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31385107/

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