我有一个表格,当我将嵌套元素的样式设置为width:80%时,其中一个左列会缩小。该列缩小并截断输入元素的右边缘。您可以通过从输入元素中删除样式来了解我在说什么。
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
</head>
<body>
<table width="100%" border="1">
<tr>
<td>
<input type="text" style="width: 80%;" />
</td>
<td>
Lots of text to make the right cell expand.
Lots of text to make the right cell expand.
Lots of text to make the right cell expand.
Lots of text to make the right cell expand.
Lots of text to make the right cell expand.
Lots of text to make the right cell expand.
Lots of text to make the right cell expand.
Lots of text to make the right cell expand.
Lots of text to make the right cell expand.
</td>
</tr>
</table>
</body>
</html>
我有一种感觉,这是因为列的大小是基于子级的,但是通过根据父级调整元素的大小,我创建了一个“catch 22”。
有人可以告诉我发生了什么,以及我如何保持相同的列宽,并将我的元素调整到其宽度的 80%?