0

次のhtmlテーブルを前提として、省略記号を失うことなく、div要素に設定する代わりに'col'要素の幅を設定することにより、最初の列の幅を制御したいと思います。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>
4

1 に答える 1

0

次のように実行できます。

<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>
于 2012-06-26T08:17:39.470 に答える