HTML表格边框与单元格边框不同 [英] HTML table border differ from cell border

查看:300
本文介绍了HTML表格边框与单元格边框不同的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我想创建一个带有border-color(让我们说红色)的表格,并且表格内的单元格边框要使用不同的颜色(让我们说蓝色),并且不将表格的边框显示为2行.
不使外部td的边框变为红色的情况下是否适用?
谢谢

Hi,

i want to create a table with border-color(lets say red) and the cell borders inside the table to be in different color(lets say blue) and without displaying the borders of the table as 2 lines.
is it applicable without making the borders of the outer td colored red??
Thanks

推荐答案

<table>
    <tr><td>1</td><td>1</td><td>1</td><td>1</td></tr>
    <tr><td>1</td><td>1</td><td>1</td><td>1</td></tr>
    <tr><td>1</td><td>1</td><td>1</td><td>1</td></tr>
    <tr><td>1</td><td>1</td><td>1</td><td>1</td></tr>
</table>


table{border: 1px solid red}
table td{border: 1px solid blue}
table tr:first-child td{border-top:none}
table tr:last-child td{border-bottom:none}
table tr td:first-child{border-left:none}
table tr td:last-child{border-right:none}



但据我所知,第一个孩子和最后一个孩子与IE并不完全兼容,我已经尝试过使用ie9并且可以正常工作,您应该在每个浏览器中尝试

或者您可以使用类来获取第一行和最后一行,以及第一列和最后一列


或更多,您可以使用js



but as i know first child and last child are not fully compatible with IE, i''ve tried with ie9 and works ok, you should try in every browser

or you can use classes to get the first and the last row, and the first and the last column


or more you can change the color with js


这篇关于HTML表格边框与单元格边框不同的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆