如何使一个表列填充所有空余水平空间? [英] How do I make one table column fill all the spare horizontal space?

查看:109
本文介绍了如何使一个表列填充所有空余水平空间?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个由3列组成的HTML表格。它的固定宽度为600像素。

I have a HTML table consisting of 3 columns. It has a fixed width of 600px.

<table>
  <tr>
    <td>Name</td>
    <td>Qty</td>
    <td>Actions</td>
  </tr>
</table>



我希望数量和操作列尽可能小(将内容保持为一行)和名称列来占用剩余的可用空间。数量和操作列的大小会根据内容/字体大小而改变,因此固定宽度在此情况下将无法使用。

I want the Qty and Actions columns to be as small as possible (keeping the content to one line) and the Name column to take up the rest of the available space. The size of the Qty and Actions column change depending on content/font size so fixed widths will not work in this case.

有一种方法可以在HTML / CSS?

Is there a way of doing this in HTML/CSS? Or is this something I need to break out the Javascript for?

推荐答案

您可以对该列应用width =99% 。例如:

You can apply width="99%" on that column. For example:

<table> 
  <tr> 
    <td width="99%">Name</td> 
    <td>Qty</td> 
    <td>Actions</td> 
  </tr> 
</table> 

这篇关于如何使一个表列填充所有空余水平空间?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆