0

我在 HTML 中有一个简单的表格> 我希望表格中的每个单元格都有自己的边框。我为它定义了一个 CSS 属性,例如:

td {
    width: 350px;   
    height: 50px;
    border:thick;
    border-color: black;
    border-radius: 5px;
}

html:

< table border="0">
    <tr><td>Row1</td></tr> 
    <tr><td>Row2</td></tr>   
    <tr><td>Row3</td></tr>
</table>

边框在“Dreamweaver 设计模式”中可见,但当文档在 Firefox 中运行时,边框消失。为什么会这样?

4

2 回答 2

4

试试这个:-

演示

见参考

<table>
    <tr><td>Row1</td></tr> 
    <tr><td>Row2</td></tr>   
    <tr><td>Row3</td></tr>
</table>


td{
width: 350px;   
height: 50px;
border: thick solid black;
border-radius: 5px;
}
于 2013-05-06T15:13:48.310 回答
0

在这种情况下,您会在浏览器之间出现偏差,我总是建议直接使用验证器!

http://validator.nu/

当我将您的代码放入时(在头部的样式标签中使用 css)给我这些错误:

Error: Bad character   after <. Probable cause: Unescaped <. Try escaping it as &lt;. At line 15, column 2 tyle>↩&lt;/head>↩&lt; table border=" Error: Stray start tag tr. From line 16, column 5; to line 16, column 8
="0">↩    <tr><td>Ro Error: Stray start tag td. From line 16, column 9; to line 16, column 12
>↩    <tr><td>Row1</ Error: Stray end tag td. From line 16, column 17; to line 16, column 21 r><td>Row1</td></tr>  Error: Stray end tag tr. From line 16, column 22; to line 16, column 26
>Row1</td></tr> ↩     Error: Stray start tag tr. From line 17, column 5; to line 17, column 8 /tr> ↩    <tr><td>Ro Error: Stray start tag td. From line 17, column 9; to line 17, column 12  ↩    <tr><td>Row2</ Error: Stray end tag td. From line 17, column 17; to line 17, column 21 r><td>Row2</td></tr>  Error: Stray end tag tr. From line 17, column 22; to line 17, column 26
>Row2</td></tr>   ↩   Error: Stray start tag tr. From line 18, column 5; to line 18, column 8 r>   ↩    <tr><td>Ro Error: Stray start tag td. From line 18, column 9; to line 18, column 12  ↩    <tr><td>Row3</ Error: Stray end tag td. From line 18, column 17; to line 18, column 21 r><td>Row3</td></tr>↩ Error: Stray end tag tr. From line 18, column 22; to line 18, column 26
>Row3</td></tr>↩&lt;/tab Error: Stray end tag table. From line 19, column 1; to line 19, column 8 /td></tr>↩&lt;/table>

最重要的是第一个条目:

Error: Bad character   after <. Probable cause: Unescaped <. Try escaping it as &lt;. At line 15, column 2 tyle>↩&lt;/head>↩&lt; table border=" Error: Stray start tag tr. From line 16, column 5; to line 16, column 8
于 2013-05-06T15:15:37.130 回答