bop*_*vla 8 html css html-table tablecell tablerow
我为客户转换了一些表格数据:
<table>
<tr>
<th><p>SPAGHETTI – Deeg voorgerechten</p></th>
</tr>
<tr>
<td>SPAGHETTI AL PESCATORE</td>
<td>€11.50</td>
<td><p >Zeevruchten in speciale tomatensaus</p></td>
</tr>
<tr>
<td>SPAGHETTI ALLA MATRICIANA</td>
<td>€9.25</td>
<td><p >Met spek, knoflook in tomatensaus</p></td>
</tr>
<tr>
<td>SPAGHETTI BOSCAIOLA</td>
<td>€10.25
</td>
<td><p >Met ham, spek, knoflook in roomsaus</p></td>
</tr>
<table>
Run Code Online (Sandbox Code Playgroud)
这是表格数据.它应该在一个表:)
在doc这个词中,他将最后一个单元格(荷兰语描述)放在一个新的行上.我可以将每个最后一个单元格正则表达为colspan ="2"的新行,但这不是结构.我试过了:
td:last-child {
display: block;
}
Run Code Online (Sandbox Code Playgroud)
但每个浏览器都忽略了这一点.有任何想法吗?
编辑:听起来有点模糊,不是吗?
我有:
cell 1.1 cell 1.2 cell 1.3
cell 2.1 cell 2.2 cell 2.3
cell 3.1 cell 3.2 cell 3.3
Run Code Online (Sandbox Code Playgroud)
我想要:
cell 1.1 cell 1.2
cell 1.3
cell 2.1 cell 2.2
cell 2.3
cell 3.1 cell 3.2
cell 3.3
Run Code Online (Sandbox Code Playgroud)
表格不能那样工作。 <tr>
表示新行,a <td>
在同一行上。在不同的行上,您永远不会拥有(或至少永远不会拥有)<td>
相同的<tr>
。
cell 1.1 cell 1.2
cell 2.1
cell 3.1 cell 3.2
cell 4.1
cell 5.1 cell 5.2
cell 6.3
Run Code Online (Sandbox Code Playgroud)
编辑:似乎您由于某种原因在不适合表的情况下挂断了表。我可以建议以下实施方式(未经测试,您应该了解我要尝试的操作的基础知识)?
<style>
.menu-item: {
display: block;
}
.price: {
float: right;
}
.description {
clear: both;
}
</style>
<h3>Spaghetti</h3>
<div class="menu-item">
<strong>Food name</strong>
<span class="price">10.00</span>
<span class="description">A great dish</span>
</div>
<div class="menu-item">
<strong>Food name</strong>
<span class="price">10.00</span>
<span class="description">A great dish</span>
</div>
<div class="menu-item">
<strong>Food name</strong>
<span class="price">10.00</span>
<span class="description">A great dish</span>
</div>
Run Code Online (Sandbox Code Playgroud)
小智 5
试试这个小提琴:
https://jsfiddle.net/r47bm836/
table tr, table tr td:nth-last-child(1) {
display: block !important;
clear: both;
}
table tr, table tr td {
clear: both;
}
Run Code Online (Sandbox Code Playgroud)
似乎对我有用。
我有同样的问题。