Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/87.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何结合文本溢出控制html表列宽_Html_Html Table_Ellipsis_Col - Fatal编程技术网

如何结合文本溢出控制html表列宽

如何结合文本溢出控制html表列宽,html,html-table,ellipsis,col,Html,Html Table,Ellipsis,Col,给定下面的html表,我想通过设置'col'元素的宽度来控制第一列的宽度,而不是在div元素上设置它,同时不丢失省略号。仅仅使用html和CSS就可以做到这一点吗 <html> <head> <style> .hideextra { white-space: nowrap; overflow: hidden; text-overflow:ellipsis; } </style> </head> <body> <tabl

给定下面的html表,我想通过设置'col'元素的宽度来控制第一列的宽度,而不是在div元素上设置它,同时不丢失省略号。仅仅使用html和CSS就可以做到这一点吗

<html>
<head>
<style>
.hideextra { white-space: nowrap; overflow: hidden; text-overflow:ellipsis; }
</style>
</head>
<body>
<table style="width: 300px">
<col /><!-- ** set width here ** -->
<tr>
    <td>Column 1</td><td>Column 2</td>
</tr>
<tr>
   <td>
    <div class="hideextra" style="width:200px">
                this is the text in column one which wraps</div></td>
   <td>
        <div class="hideextra" style="width:100px">
                this is the column two test</div></td>
</tr>
</table>
</body>
</html>

.hideextra{空白:nowrap;溢出:隐藏;文本溢出:省略号;}
第1列第2列
这是第一列中包装的文本
这是第二列测试

可以这样做:

<table border="1" width="100%" style="table-layout: fixed; ">
<col width="60px">
<tr>
    <td style="overflow: hidden;text-overflow: ellipsis;">500.000.000.000.000</td>
    <td>10.000</td>
</tr>
<tr>
    <td>1.500.000</td>
    <td>2.000</td>
</tr>
</table>

500.000.000.000.000
10
1.500.000
2