我在最后几个小时面临一个问题,我无法弄明白。我在php脚本中定义了一个html表,如下所示:
/*
Generic Styling, for Desktops/Laptops
*/
#table_products
{
display: block;
}
table {
width: 100%;
height: 300px;
max-height: 300px;
border-collapse: collapse;
overflow:auto;
font-size:11px;
}
table thead tr{
height: 35px; max-height: 35px;
}
/* Zebra striping */
tr:nth-of-type(odd) {
background: #eee;
}
th {
background: #333;
color: white;
font-weight: bold;
}
td, th {
padding: 2px;
border: 1px solid #ccc;
text-align: center;
white-space: -moz-pre-wrap !important; /* Mozilla, since 1999 */
white-space: -pre-wrap; /* Opera 4-6 */
white-space: -o-pre-wrap; /* Opera 7 */
white-space: pre-wrap; /* css-3 */
word-wrap: break-word; /* Internet Explorer 5.5+ */
white-space: -webkit-pre-wrap; /* Newer versions of Chrome/Safari*/
word-break: break-all;
white-space: normal;
vertical-align: middle;
}
@media
only screen and (max-width: 760px),
(min-device-width: 768px) and (max-device-width: 1024px) {
/* Force table to not be like tables anymore */
table, thead, tbody, th, td, tr {
display: block;
}
th {
font-weight: bold;
vertical-align: middle;
}
/* Hide table headers (but not display: none;, for accessibility) */
thead tr {
position: absolute;
top: -9999px;
left: -9999px;
}
tr { border: 1px solid #ccc; }
td {
/* Behave like a "row" */
border: none;
border-bottom: 1px solid #eee;
position: relative;
padding-left: 50%;
}
td:before {
/* Now like a table header */
position: absolute;
/* Top/left values mimic padding */
top: 6px;
left: 6px;
width: 45%;
padding-right: 10px;
white-space: -moz-pre-wrap !important; /* Mozilla, since 1999 */
white-space: -pre-wrap; /* Opera 4-6 */
white-space: -o-pre-wrap; /* Opera 7 */
white-space: pre-wrap; /* css-3 */
word-wrap: break-word; /* Internet Explorer 5.5+ */
white-space: -webkit-pre-wrap; /* Newer versions of Chrome/Safari*/
word-break: break-all;
white-space: normal;
}
/*
Label the data
*/
td:nth-of-type(1):before { content: "X"; }
td:nth-of-type(2):before { content: "Προιόν"; }
td:nth-of-type(3):before { content: "#"; }
td:nth-of-type(4):before { content: "Τιμή+"; }
}
/* Smartphones (portrait and landscape) ----------- */
@media only screen
and (min-device-width : 320px)
and (max-device-width : 480px) {
body {
padding: 0;
margin: 0;
width: 320px; }
}
/* iPads (portrait and landscape) ----------- */
@media only screen and (min-device-width: 768px) and (max-device-width: 1024px) {
body {
width: 495px;
}
}

<div id="table_products">
<table>
<thead>
<tr>
<th style="width:7%">X</th>
<th style="width:58%">Προιόν</th>
<th style="width:15%">#</th>
<th style="width:20%">Τιμή+</th>
</tr>
</thead>
<tbody>
<tr>
<td>x</td>
<td>Salata </td>
<td>234</td>
<td>22.5679</td>
</tr>
</tbody>
</table>
</div>
&#13;
但是我无法正确获得每一行的高度。我在桌子上的两行都有50%的高度,并填满整个300px的桌子高度。我希望每行的高度仅为25像素,并忽略表格的高度。
感谢任何建议