2015-06-19 59 views
-1

基本上裏面,我想對準子彈在同一行作爲table.But內上述TD標籤內容默認情況下,UL標籤增加了一個縮進。刪除縮進TD

我試着加入margin:0, padding:0,它實際上是把所有的子彈都排在一起。我想把這些句子排在同一行上去掉子彈。

基本上在下面的jsfiddle例如:heading2欄應全部對準了權,這意味着內容和子彈應該從同一點

HTML開始:

<table class='table_css'> 
    <th>heading1</th> 
    <th>heading2</th> 
    <tr><td>row1</td><td>content in row 1</td></tr> 


    <tr> 
     <td>some heading</td> 
     <td> 
<ul> 
    <li>some text which is very long</li> 
    <li>some text which is very long some text which is very long</li> 
    <li>some text which is very long some text which is very long some text which is very long</li> 
</ul> 
     </td> 
      </tr>  
</table> 

CSS:

ul{ 
    margin:0; 

} 

.table_css{ 
    border:1px solid;border-collapse: collapse;table-layout:fixed; 
} 

Jsfiddle

+2

您的HTML無效;唯一''和''​​,元件必須被包裹在''元素。 –

回答

1

只需添加一個向左填充15px以水平對齊標題和項目符號。

ul { 
 
    margin: 0; 
 
    padding-left: 15px; 
 
} 
 
.table_css { 
 
    border: 1px solid; 
 
    border-collapse: collapse; 
 
    table-layout: fixed; 
 
}
<table class='table_css'> 
 
    <th>heading1</th> 
 
    <th>heading2</th> 
 
    <tr> 
 
    <td>row1</td> 
 
    <td>content</td> 
 
    </tr> 
 

 

 
    <tr> 
 
    <td>some heading</td> 
 
    <td> 
 
     <ul> 
 
     <li>some text which is very long</li> 
 
     <li>some text which is very long some text which is very long</li> 
 
     <li>some text which is very long some text which is very long some text which is very long</li> 
 
     </ul> 
 
    </td> 
 
    </tr> 
 
</table>