首先我們要做出的表格
Paste_Image.png
<table>
<caption>標題文本</caption> `
這一部分是用來寫購物車這個標題
而代碼主體在下面短荐,你可以復制驗證
<table border="1">
<tr>
<th rowspan="2">名稱 </th>
<th colspan="2">2016-11-22</th>
<th rowspan="2">小計 </th>
</tr>
<tr><th> 重量</th>
<th>單價</th>
</tr>
<tr>
<th>蘋果 </th>
<td>3公斤</td>
<td>5元/公斤</td>
<td>15元</td>
</tr>
<tr>
<th>香蕉 </th>
<td>2公斤 </td>
<td>6元/公斤</td>
<td>12元</td>
</tr>
<tr>
<th colspan="3">總價</th>
<td>27元 </td>
</tr>`
首先,我要講的是基礎知識
<table>:定義HTML文檔中的表格 <tr>定義表格中的一行 <th>定義表格中的表頭 <table border=”1”>設置邊框<td>定義表格中的`一列
這里聲明<th>效果加粗字體
其次盐类,我們要講對表格的添加屬性晰绎,
我們這里需要的是rowspan和colspan兩種屬性rowspan和colspan分別設置表格的占用標準表格的幾行和幾列