Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/238.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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/css/38.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
使用PHP输入文本时防止表扩展_Php_Css_Html Table_Overflow - Fatal编程技术网

使用PHP输入文本时防止表扩展

使用PHP输入文本时防止表扩展,php,css,html-table,overflow,Php,Css,Html Table,Overflow,我有下面的嵌套表,正在使用PHP设置其中一个tds的文本内容。除了文本超过表格大小时,表格会展开之外,一切都正常。我想防止这种情况发生,但style=“overflow:hidden”似乎不起作用 <table id="mainEditTable" style="overflow:hidden" width="826px" border="0" cellpadding="5"> <tr> <td class="mainEntryRowVis" id="g

我有下面的嵌套表,正在使用PHP设置其中一个tds的文本内容。除了文本超过表格大小时,表格会展开之外,一切都正常。我想防止这种情况发生,但
style=“overflow:hidden”
似乎不起作用

<table id="mainEditTable" style="overflow:hidden" width="826px" border="0" cellpadding="5">
  <tr>
    <td class="mainEntryRowVis" id="guestEntries1"><table style="overflow:hidden" class="gstTblPad" width="100%" border="0" cellpadding="0">
        <tr>
          <th width="100%" scope="col">Delete old GDOCS</th>
        </tr>
        <tr>
          <td class="nmBldrEntry" onclick="selectText('nbe1');" id="nbe1"><?php echo $_POST["deleteGdocs"];?></td>
        </tr>
      </table></td>
  </tr>
</table>
我做错了什么?

更新:有没有办法在不影响th元素的情况下实现这一点?
你必须给它一个最大宽度。这对我很管用

max-width: 100px;

/* additional */
word-wrap: break-word;
overflow: hidden;

Break word表示文本将换行到下一行。我不知道你是否需要它。

你应该使用
表格布局:固定作为表的css属性值对。然后在此表的tds上使用
overflow:hidden


请参见

请参见。有没有办法在不使tr元素的cetered文本像上面我的编辑中所示那样偏移的情况下实现这一点?
max-width: 100px;

/* additional */
word-wrap: break-word;
overflow: hidden;