我想画我的表格的边框HTML页面上:绘制HTML表格边框
HTML:
<asp:Table>
<asp:TableRow CssClass="columnHeader">
<asp:TableCell BorderWidth="0px" BackColor="White"></asp:TableCell>
<asp:TableCell ColumnSpan="3" ><asp:Label ID="lbl_Dimension" runat="server" >Dimension in CM</asp:Label></asp:TableCell>
<asp:TableCell ColumnSpan="2" ><asp:Label ID="lbl_Weight" runat="server" >Weight in KG</asp:Label></asp:TableCell>
<asp:TableCell ><asp:Label ID="lbl_Volume" runat="server" >Volume</asp:Label></asp:TableCell>
</asp:TableRow>
<asp:TableRow CssClass="columnHeader">
<asp:TableCell BorderWidth="0px" BackColor="White"></asp:TableCell>
<asp:TableCell ><asp:Label /></asp:TableCell> (x6)
</asp:TableRow>
<asp:TableRow>
<asp:TableCell CssClass="rowHeader"><asp:Label ID="lbl_Pallet" runat="server" >Pallet</asp:Label></asp:TableCell>
<asp:TableCell ><asp:Label /></asp:TableCell> (x6)
</asp:TableRow>
<asp:TableRow >
<asp:TableCell CssClass="rowHeader"><asp:Label ID="lbl_Master" runat="server" >Master</asp:Label></asp:TableCell>
<asp:TableCell ><asp:Label /></asp:TableCell> (x6)
</asp:TableRow>
<asp:TableRow>
<asp:TableCell CssClass="rowHeader"><asp:Label ID="lbl_Inner" runat="server" >Inner</asp:Label></asp:TableCell>
<asp:TableCell ><asp:Label /></asp:TableCell> (x6)
</asp:TableRow>
</asp:Table>
CSS:
.drawBorder table
{
border: 0 solid Black;
border-spacing: 0;
margin-top: 30px;
border-collapse: collapse;
}
.drawBorder th, .drawBorder td
{
border: 1px solid Black;
width: 80px;
}
.rowHeader
{
background-color: #f4e8d0;
font-weight: bold;
}
.columnHeader
{
text-align: center;
background-color: #f4e8d0;
border: 1px solid Black;
font-weight: bold;
}
结果上IE:
结果在Chrome:
所以......两个问题:
- 为什么IE不能做我的第一行
ColSpan
? - 为什么
border-collapse: collapse;
不起作用?
(我不写我完整的HTML代码,因为我不能发布主要是代码的消息...)
你的表是全错的 - 表中的每一行的列数不匹配 – Pete
我在帖子的底部写道,我没有发布我所有的HTML代码,我可以告诉你我的列数是相同的每一行;) – Shadam
那么你说html代码不是asp代码有一个很大的区别,你已经添加了x6后,我评论 – Pete