Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/css/41.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_Css - Fatal编程技术网

Html 如何避免扩展表属性?

Html 如何避免扩展表属性?,html,css,Html,Css,我正在尝试创建表,并呈现从API收到的数据,我的html css如下所示: ///html <section id="Characters"> <table id="customers"> <tr> <th><strong>Category</strong></th> <th><strong>Name</strong><

我正在尝试创建表,并呈现从API收到的数据,我的html css如下所示:

///html
<section id="Characters">
    <table id="customers">
      <tr>
        <th><strong>Category</strong></th>
        <th><strong>Name</strong></th>
        <th><strong>Nickname</strong></th>
        <th><strong>Work</strong></th>
        <th><strong>Image</strong></th>

      </tr>
      <tr>
        <td></td>
        <td></td>
        <td></td>
        <td></td>
        <td></td>
      </tr>
    </table>

  </section>
//css
#customers {
  font-family: "Trebuchet MS", Arial, Helvetica, sans-serif;

  width: 200%;
}


#customers td, #customers th {
  border: 1px solid #ddd;
  padding: 8px;
}

#customers tr:nth-child(even){background-color: #f2f2f2;}

#customers tr:hover {background-color: #ddd;}

#customers th {
  padding-top: 12px;
  padding-bottom: 12px;
  text-align: left;
  background-color: #4CAF50;
  color: white;
}
但这不起作用

添加

table{
    table-layout:fixed;
}

加:

加:


固定桌子布局并给它一个宽度可以解决这个问题。试试这个


表{table layout:fixed;width:1000px;}

固定表布局并给它一个宽度可以解决这个问题。试试这个

表{表布局:固定;宽度:1000px;}

尝试以下操作:

顾客{ 字体系列:投石机MS,Arial,Helvetica,无衬线; 宽度:60%; 表布局:已修复;/*请尝试以下操作:

顾客{ 字体系列:投石机MS,Arial,Helvetica,无衬线; 宽度:60%; 表布局:固定/*
table{
    table-layout:fixed;
}
td {
  word-break: break-word;
}