从文本包装其他列的文本中停止使用100%宽度的HTML表列
我有一个带有三列的HTML表(宽度为100%),宽度为100%。它可以正常工作,但是迫使左右列以文字包含其内容,即使屏幕上有足够的空间未包装。下图说明了我的问题。有足够的空间显示“南美”和第三列的整体,但中间的柱子迫使他们包裹。
这是代码:
<table style="width: 100%;" border="1">
<tr>
<td>South America</td>
<td style="width: 100%;">Green Beans</td>
<td>$25,000 per kg</td>
</tr>
</table>
我不想nowrap
,而表格:filex
并不完美。有一个“适当的”技巧可以做到吗?
I have an HTML table (with 100% width) with three columns, the middle one with 100% width. It works fine, but it forces the left and right columns to text-wrap their contents, even if there is enough space on the screen to show them un-wrapped. The image below illustrates my problem. There is enough space to show "South America" and the third column whole, but the middle column forces them to wrap.
Here is the code:
<table style="width: 100%;" border="1">
<tr>
<td>South America</td>
<td style="width: 100%;">Green Beans</td>
<td>$25,000 per kg</td>
</tr>
</table>
I don't want to nowrap
, and table-layout: fixed
is not perfect. Is there a "proper" trick to do this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
使用Flexbox及其状态,以便您可以使用以下代码轻松解决问题,以满足您的要求。
Use the Flexbox and its states so you can easily solve your problem using the below code to fulfill your requirement.