2017-02-14 114 views

回答

2

使用下面的CSS,你會得到你的結果:

td[rowspan] { 
    position: relative; 
} 

td[rowspan]:before { 
    content: ''; 
    height: 80%; 
    width: 20%; 
    border: 2px solid blue; 
    border-right: none; 
    position: absolute; 
    top: 10%; 
    right: 10px; 
} 

這裏是jsbin鏈接:http://jsbin.com/juzasemeje/edit?html,css,output 您可以自定義一點點地滿足您的要求的值。

2

是這個輸出る期待

校驗輸出在Jsbin.com

.border{ 
border-top:2px solid blue; 
border-left:2px solid blue; 
border-bottom:2px solid blue; 
height:50px; 
width:20px; 
position:relative; 
left:100px; 
bottom:10px 
} 

更新烏爾CSS如上

+0

和我的想法一樣。但請使其更通用,因爲行跨度的數量可能不同。 –

+0

@ManhLe我沒有得到R U的評論? –

+1

我的意思是'height:50px'在其他情況下並不總是很好看。行高越高(ex> = 6),'td'邊界的空白就越多。如果我們可以設置相對於「td」高度的邊框高度,那會更好。 –

1

試試這個

.td-line { 
 
    position: relative; 
 
} 
 

 
.td-line:before { 
 
    content: ''; 
 
    display: block; 
 
    width: 20px; 
 
    height: 73%; 
 
    position: absolute; 
 
    right: 10px; 
 
    top: 13%; 
 
    border-top: solid 1px blue; 
 
    border-bottom: solid 1px blue; 
 
    border-left: solid 1px blue; 
 
}
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
 
<html xmlns="http://www.w3.org/1999/xhtml"> 
 
<head> 
 
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 
 
<title>Untitled Document</title> 
 
</head> 
 

 
<body> 
 
<table border="1"> 
 
    <tr> 
 
    <th width="150" scope="col">&nbsp;</th> 
 
    <th width="100" scope="col">&nbsp;</th> 
 
    <th width="100" scope="col">&nbsp;</th> 
 
    <th width="100" scope="col">&nbsp;</th> 
 
    <th width="100" scope="col">&nbsp;</th> 
 
    </tr> 
 
    <tr> 
 
    <td rowspan="3" class="td-line">&nbsp;</td> 
 
    <td>&nbsp;</td> 
 
    <td>&nbsp;</td> 
 
    <td>&nbsp;</td> 
 
    <td>&nbsp;</td> 
 
    </tr> 
 
    <tr> 
 
    <td>&nbsp;</td> 
 
    <td>&nbsp;</td> 
 
    <td>&nbsp;</td> 
 
    <td>&nbsp;</td> 
 
    </tr> 
 
    <tr> 
 
    <td>&nbsp;</td> 
 
    <td>&nbsp;</td> 
 
    <td>&nbsp;</td> 
 
    <td>&nbsp;</td> 
 
    </tr> 
 
    <tr> 
 
    <td>&nbsp;</td> 
 
    <td>&nbsp;</td> 
 
    <td>&nbsp;</td> 
 
    <td>&nbsp;</td> 
 
    <td>&nbsp;</td> 
 
    </tr> 
 
    <tr> 
 
    <td rowspan="4" class="td-line">&nbsp;</td> 
 
    <td>&nbsp;</td> 
 
    <td>&nbsp;</td> 
 
    <td>&nbsp;</td> 
 
    <td>&nbsp;</td> 
 
    </tr> 
 
    <tr> 
 
    <td>&nbsp;</td> 
 
    <td>&nbsp;</td> 
 
    <td>&nbsp;</td> 
 
    <td>&nbsp;</td> 
 
    </tr> 
 
    <tr> 
 
    <td>&nbsp;</td> 
 
    <td>&nbsp;</td> 
 
    <td>&nbsp;</td> 
 
    <td>&nbsp;</td> 
 
    </tr> 
 
    <tr> 
 
    <td>&nbsp;</td> 
 
    <td>&nbsp;</td> 
 
    <td>&nbsp;</td> 
 
    <td>&nbsp;</td> 
 
    </tr> 
 
    <tr> 
 
    <td>&nbsp;</td> 
 
    <td>&nbsp;</td> 
 
    <td>&nbsp;</td> 
 
    <td>&nbsp;</td> 
 
    <td>&nbsp;</td> 
 
    </tr> 
 
</table> 
 
<p>&nbsp;</p> 
 
</body> 
 
</html>