1

ブラウザウィンドウが24インチのモニターに最大化され、より通常のサイズに最小化されたときに、テキストが折り返されないようにする方法を見つけようとしています。HTMLテーブル内のセルに固定数のスペースを設定すると、これは役立つと思いますが、方法がわかりません...何かアイデアはありますか?私のモニターは24インチなので、通常のサイズに最小化すると折り返しが発生します。私が助けを求めたかった私の主な3つのテキスト領域は次のとおりです。

1<td colspan="90"><input name="Gift Wrapping" id="Gift Wrapping" type="checkbox" /> Gift wrapping? (Additional charge of 1.95 per box)</td>

2<td colspan="40">If yes, note the text for the gift card:</td>

3<td colspan="150">$5.95 for 1-5 boxes, $10.95 for five or more boxes</td>

さまざまなブラウザ(IE、Firefox、Chrome)でWebページを開くと、これらのセル内のテキストが1行にうまく収まるか、折り返されます。包みたくない。私はそれらを各ブラウザですべて同じように見せたいのですが、これを行う方法があるのだろうかと思いました。ありがとう!

私のコード:

<!--Order Info. table -nested table 2 -->
<!--This is the first nested table within the main table -->
        <table border="2" width="65%" cellpadding="2">
        <!--Row 1 -->
                <tr>
                    <th colspan="3" align="left">Order Information</th>
                </tr>
        <!--Row 2 -->   
                <tr>
                    <td>QTY</td>
                    <td colspan="15"></td>
                    <td>Subtotal</td>
                    <td colspan="90"><input name="Gift Wrapping" id="Gift Wrapping" type="checkbox" /> Gift wrapping? (Additional charge of 1.95 per box)</td>
                </tr>
        <!-- Row 3 -->  
                <tr>
                    <td><input name="quantitya" id="quantitya" size="3" type="textbox" value="0"/></td>
                    <td colspan="4"></td>
                    <td colspan="11" align="left">Chocolate Nut - $10.99</td>
                    <td><input name="subtotala" id="subtotala" size="10" type="textbox" value="0"/></td>
                    <td colspan="40">If yes, note the text for the gift card:</td>
                </tr>
        <!-- Row 4 -->  
                <tr>
                    <td><input name="quantityb" id="quantityb" size="3" type="textbox" value="0"/></td>
                    <td colspan="4"></td>
                    <td colspan="11" align="left">Chocolate Chip - $9.99</td>
                    <td><input name="subtotalb" id="subtotalb" size="10" type="textbox" value="0"/></td>
                    <td colspan="5"><textarea wrap="soft" name="giftcardtext" id="giftcardtext" rows="3" cols="20" ></textarea></td> 
                </tr>
        <!--Row 5 -->
                <tr>
                    <td><input name="quantityc" id="quantityc" size="3" type="textbox" value="0"/></td>
                    <td colspan="4"></td>
                    <td colspan="11" align="left">Macadamia Nut - $12.99</td>
                    <td><input name="subtotalc" id="subtotalc" size="10" type="textbox" value="0"/></td> 
                </tr>
        <!--Row 6 -->
                <tr>
                    <td><input name="quantityd" id="quantityd" size="3" type="textbox" value="0"/></td>
                    <td colspan="4"></td>
                    <td colspan="11" align="left">Oatmeal Raisin - $10.99</td>
                    <td><input name="subtotald" id="subtotald" size="10" type="textbox" value="0"/></td> 
                </tr>
        <!--Row 7 -->
                <tr>
                    <td><input name="quantitye" id="quantitye" size="3" type="textbox" value="0"/></td>
                    <td colspan="4"></td>
                    <td colspan="11" align="left">Chocolate Dessert - $10.99</td>
                    <td><input name="subtotale" id="subtotale" size="10" type="textbox" value="0"/></td></td>
                    <td>Shipping:</td>
                    <td colspan="30"></td>
                    <td colspan="150">$5.95 for 1-5 boxes, $10.95 for five or more boxes</td>
                </tr>
        <!--Row 8 -->
                <tr>
                    <td><input name="quantityf" id="quantityf" size="3" type="textbox" value="0"/></td>
                    <td colspan="4"></td>
                    <td colspan="11" align="left">Butter - $7.99</td>
                    <td><input name="subtotalf" id="subtotalf" size="10" type="textbox" value="0"/></td></td>
                    <td>Total:</td>
                    <td colspan="30"></td>
                    <td colspan="1"><input name="totala" id="totala" size="3" type="textbox" value="0.00" /></td>
                </tr>
        <!--Row 9 -->
                <tr>
                    <td colspan="0"></td>
                    <td colspan="4"></td>
                    <td colspan="11" align="left">Subtotal</td>
                    <td><input name="subtotalg" id="subtotalg" size="10" type="textbox" value="0" /></td></td>
                </tr>
        </table>
4

3 に答える 3

0

コルスパンは、そのTDが他のTDのセルを通過できるようにすることです。あなたがしていることは、Divsとwidthではるかにうまくいくように見えます。

すべてのTRに同じ数の列があるわけではなく、それは必須です。

div style = "float:left; width:###;"を使用してみてください それらを単純なコンテナとして使用し、必要な幅に設定します。

于 2010-02-17T00:15:42.650 に答える
0

colspanを誤って使用しています。次のようなことを試すことができます:

<TABLE BORDER="2" CELLPADDING="2" CELLSPACING="2" WIDTH="100%">
<TR>
<TD WIDTH="25%">Column 1</TD>
<TD WIDTH="75%">Column 2</TD>
</TR>
</TABLE>
于 2010-02-17T00:16:43.773 に答える
0

テキストを折り返したくない場合は、いつでも次を使用できます。

TD { white-space:nowrap }

それ以外の場合、カスタムルールを適用する場合は、通常、列ごとにクラスを追加します。幅を設定しないクラスは弾力性があり、列3は残りのスペースを占める必要があります。例:

TD.c1 { width: 200px; } 
TD.c2 { width: 200px; }
...
<td class="c1"></td>
<td class="c2"></td>
<td class="c3"></td>
于 2010-02-17T00:18:14.410 に答える