您好我想从html表中删除垂直线,只有特定的垂直线想在我的html表中删除只有3条垂直线,我只想删除1和3行
这是我的代码
<html>
<head>
<style type="text/css">
.table1{
background: -moz-linear-gradient(-90deg, #003471, #448CCB);
background: -webkit-gradient(linear, left top, left bottom, from(#003471), to(#448CCB));
}
table, th, td {
border-left: none;
border-right: none;
}
</style>
</head>
<body>
<div id="div1" class='display'>
<table width="100%" border="1" align="center" cellpadding="0" cellspacing="1" bordercolor='66A8FF'>
<tr class="table1" style="border-collapse:collapse">
<td width="25%" height="48px" align="center" style="font-size:28px"><font color="#fff">Text1</font></td>
<td width="25%" height="48px" align="center" style="font-size:28px"><font color="#fff">Text2</font></td>
<td width="25%" height="48px" align="center" style="font-size:28px"><font color="#fff">Text3</font></td>
<td width="25%" height="48px" align="center" style="font-size:28px"><font color="#fff">Text4</font></td>
</tr>
<tr class="table1" style="border-collapse:collapse">
<td width="25%" height="48px" align="center" style="font-size:28px"><font color="#fff">Text1</font></td>
<td width="25%" height="48px" align="center" style="font-size:28px"><font color="#fff">Text2</font></td>
<td width="25%" height="48px" align="center" style="font-size:28px"><font color="#fff">Text3</font></td>
<td width="25%" height="48px" align="center" style="font-size:28px"><font color="#fff">Text4</font></td>
</tr>
</table>
</div>
</body>
</html>
这是我的JSFiddle
我怎样才能实现我的目标
提前致谢
答案 0 :(得分:2)
使用CSS:
table{
border-collapse:collapse;
}
td:nth-child(2){
border-right:1px solid white;
}
答案 1 :(得分:0)
我不确定SW4是否有你想要的东西,但我还有其他一些说明:
.table1 td
而不是td
。我认为只有css重置才能覆盖标签.table1{
background: -moz-linear-gradient(-90deg, #003471, #448CCB);
background: -webkit-gradient(linear, left top, left bottom, from(#003471), to(#448CCB));
border: 1px solid #66A8FF;
}
table, th, td {
border-left: none;
border-right: none;
}
td {
font-size:28px;
color: #fff;
text-align: center;
height: 48px;
}
table{
border-collapse:collapse;
}
td:nth-child(2){
border-right:1px solid white;
}
<table width="100%" border="1" align="center" cellpadding="0" cellspacing="1">
<tr class="table1" style="border-collapse:collapse">
<td width="25%">Text1</td>
<td width="25%">Text2</td>
<td width="25%">Text3</td>
<td width="25%">Text4</td>
</tr>
<tr class="table1" style="border-collapse:collapse">
<td width="25%">Text1</td>
<td width="25%">Text2</td>
<td width="25%">Text3</td>
<td width="25%">Text4</td>
</tr>
</table>
http://jsfiddle.net/MartinThoma/B6WZY/
答案 2 :(得分:0)
为第二个td设置类并应用border-right:2px solid #FFF。
例如:
<html>
<head>
<style type="text/css">
.table1{
background: -moz-linear-gradient(-90deg, #003471, #448CCB);
background: -webkit-gradient(linear, left top, left bottom, from(#003471), to(#448CCB));
}
table, th, td {
border-right: none;
}
.set_border
{
border-right:3px solid #FFF;
}
</style>
</head>
<body>
<div id="div1" class='display'>
<table width="100%" border="1" align="center" cellpadding="0" cellspacing="0" bordercolor='66A8FF'>
<tr class="table1" style="border-collapse:collapse">
<td width="25%" height="48px" align="center" style="font-size:28px"><font color="#fff">Text1</font></td>
<td width="25%" height="48px" align="center" style="font-size:28px" class="set_border"><font color="#fff">Text2</font></td>
<td width="25%" height="48px" align="center" style="font-size:28px" ><font color="#fff">Text3</font></td>
<td width="25%" height="48px" align="center" style="font-size:28px"><font color="#fff">Text4</font></td>
</tr>
<tr class="table1" style="border-collapse:collapse">
<td width="25%" height="48px" align="center" style="font-size:28px"><font color="#fff">Text1</font></td>
<td width="25%" height="48px" align="center" style="font-size:28px" class="set_border"><font color="#fff">Text2</font></td>
<td width="25%" height="48px" align="center" style="font-size:28px"><font color="#fff">Text3</font></td>
<td width="25%" height="48px" align="center" style="font-size:28px"><font color="#fff">Text4</font></td>
</tr>
</table>
</div>
</body>
</html>
答案 3 :(得分:0)
这是您提出的代码
<div id="div1" class='display'>
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0" bordercolor='66A8FF'>
<tr class="table1" style="border-collapse:collapse">
<td width="25%" height="48px" align="center" style="font-size:28px"><font color="#fff">Text1</font></td>
<td class="remove_line" width="25%" height="48px" align="center" style="font-size:28px"><font color="#fff">Text2</font></td>
<td width="25%" height="48px" align="center" style="font-size:28px"><font color="#fff">Text3</font></td>
<td class="remove_line1" width="25%" height="48px" align="center" style="font-size:28px"><font color="#fff">Text4</font></td>
</tr>
<tr class="table1" style="border-collapse:collapse">
<td width="25%" height="48px" align="center" style="font-size:28px"><font color="#fff">Text1</font></td>
<td class="remove_line" width="25%" height="48px" align="center" style="font-size:28px"><font color="#fff">Text2</font></td>
<td width="25%" height="48px" align="center" style="font-size:28px"><font color="#fff">Text3</font></td>
<td width="25%" height="48px" align="center" style="font-size:28px"><font color="#fff">Text4</font></td>
</tr>
</table>
</div>
和CSS
.table1{
background: -moz-linear-gradient(-90deg, #003471, #448CCB);
background: -webkit-gradient(linear, left top, left bottom, from(#003471), to(#448CCB));
}
table, th, td {
}
.remove_line{
border-right:2px solid red;
}