gpt4 book ai didi

html - 为什么 TABLE 不遵循我的 RIGHT css 样式?

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

我有以下代码,并期望 TABLE 会随着浏览器窗口缩小。但事实并非如此。为什么?

<body>
<table style="position:fixed; left:50px; right:50px; bottom:50px; border:solid">
<tr>
<td style="border:solid">Left cell</td>
<td style="border:solid">Right cell</td>
</tr>
</table>
</body>

更新

我什至对 CSS 语言感到很失望,但显然那些说不可能同时应用 RIGHT 和 LEFT 样式的人是错误的!

所以这是可能的,例如对于 DIV。

我还发现下面的代码效果更好:

<table>
<tr style="position:fixed; left:50px; right:50px; bottom:50px; border:solid">
<td style="border:solid; width:inherit">Left cell</td>
<td style="border:solid; width:inherit">Right cell</td>
</tr>
</table>

最佳答案

您绝对可以rightleft 属性应用于一个元素。问题(我认为)是表格是一种特殊情况 - 如果未明确指定宽度,它们只会拉伸(stretch)以适应其中内容的宽度。

你需要做 something like this ,使用定位包装器 div 并设置 tablewidthheight 来填充它。

关于html - 为什么 TABLE 不遵循我的 RIGHT css 样式?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8169496/

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