我的表列在html中自动增加

My table column in html automatically increases

本文关键字:增加 html 我的      更新时间:2023-09-26

这是我的代码。

 <table id="addComments" style="width:430px; table-layout:fixed; display:none; padding-right:3px; padding-left:3px;">
                <tr>
                <td colspan="3">
                <textarea  id="textArea" rows="15" cols="0" style="width:430px; overflow:hidden;"></textarea>
                </td>
                </tr>
                <tr> 
                <td>
                <div id="noComments" style="color:red; display:none;">Please write your comments.</div>
                </td>
                    <td>   
                here is some image whose display is none
                    </td>
                <td> 
                <input id="commentBtn" type="button"  onclick="getTxt()" value="Add Comments"  class="button default bt-large"/>
                </td>
                </tr>
              </table>

其中第1行是colspan在第2行有3列其中2列显示无当其中一个隐藏列可见第一行自动扩展请任何解决方案

您已经有了一个div来显示消息。去掉三列,只用一列。显示/隐藏列在浏览器中不太好用。对于图像和按钮,只需提到display: inline-block。

使用visibility: hidden;代替display:none;,这将为内容保留空间,但不可见