2010-02-18 40 views
0

我有一個系細胞(或div的)的:使一個細胞或股利縮水給房間爲他人

cell1 
cell2 
cell3 
cell4 

我想小區1小區2和小區4始終顯示所有的數據(也縮小到如果線路上沒有足夠的空間,我希望cell2剪切其數據以防止線路纏繞。

我也希望cell4對齊到該行的右側。

cell1 cell2   cell3        cell4 

data clipped data data        data 

想法?

+0

我知道你的意思是HTML,但編輯你的問題,讓大家知道的話,請注意 – 2010-02-18 07:33:48

回答

0
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> 
<html>                          
<head>                          
<style type="text/css">                      

#example { 
    width: 800px; 
    border: 2px solid yellow; 
}       

.cell1 { border:1px solid red; 
    vertical-align:top;   
    text-align:left;    
    word-wrap:break-word; 
    width:100px; 
} 
.cell2 { border:1px solid green; 
    vertical-align:top; 
    text-align:left; 
    width:100px; 
    display:block; 
    overflow:hidden; 
} 
.cell3 { border:1px solid blue; 
    vertical-align:top; 
    text-align:left; 
    word-wrap:break-word; 
    width:300px; 
} 
.cell4 { border:1px solid silver; 
    vertical-align:top; 
    text-align:right; 
    word-wrap:break-word; 
    width:300px; 
} 
.odd {} 
.even {} 

</style> 
<body> 

<table id="example"> 
<colgroup> 
<col></col><col></col><col></col><col></col> 
</colgroup> 
<thead> 
<tr><th>cell1</th><th>cell2</th><th>cell3</th><th>cell4</th></tr> 
</thead> 
<tr class="odd"> 
<td class="cell1"> 
1234 2345 3456 4567 
</td> 
<td class="cell2"> 
clip123clip123clip123clip123clip123clip123 
</td> 
<td class="cell3"> 
asdf asdf asdf sdfg 
</td> 
<td class="cell4"> 
sdfg sdfg sdfg sdfg sdfg sdfg sdfg 
</td> 
</tr> 
</table> 


</body> 
</html> 
+0

可以從表和cell1,2,4爲了得到「縮水」的一部分工作刪除寬度。忘記了這個例子。 – initall 2010-02-18 08:38:06