Html 如何避免扩展表属性?
我正在尝试创建表,并呈现从API收到的数据,我的html css如下所示: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><
///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;
}