2012-12-18 17 views
0

我有一個從文本文件加載的表格。該表包含在一個容器div中。我已經對錶格進行了樣式設置,但是當表格的容器div的寬度列過多時,內容溢出並且現在可以滾動。但是,從發生溢出的角度來看,這不是問題,表格的樣式不再適用。CSS未被應用於溢出

請看看圖片:

Table with overflow content

此表的造型下面:

table.static { 
width: 100%; 
margin-bottom: 0!important; 
margin-top: 0!important; 
} 

table.static thead { 
    background: #D0D6DA; 
    border-bottom: 1px solid #aaa; 
} 

table.static thead tr th { 
border-left: none; 
border-right: none; 
line-height: 30px; 
padding: 0 10px; 
text-align: left; 
color: #333; 
font-weight: 400; 
text-shadow: 0 1px 0 #fff; 
} 

table.static tbody tr td { 
line-height: 25px; 
padding: 0 10px; 
border: 0 solid #999; 
} 

table.static tbody tr td { 
border-bottom: 1px solid #E1E5E7; 
} 

table.static tbody tr:last-child td { 
border-bottom: 0; 
} 

table.static tbody tr.even td { 
background-color: #EDF1F3; 
border-bottom: 1px solid #D8DCDE; 
} 

table.static tbody tr td input, 
table.static tbody tr td button { 
margin: 10px 0; 
} 

任何人都可以請解釋爲什麼發生這種情況,並且我能做些什麼要解決這個問題?謝謝

+2

A [的jsfiddle(http://jsfiddle.net/)(或類似)將有助於解釋自己的觀點。 – jaypeagi

+0

HTML代碼將在這裏有用 –

回答

2

試試這個

table.static { 
    min-width: 100%; 
    margin-bottom: 0!important; 
    margin-top: 0!important; 
} 
+0

這似乎爲我解決它。不知道爲什麼,但是謝謝:) –

+0

這是因爲你的桌子超過了屏幕寬度的100%(至少這是我的猜測),並且你已經設置了100%的「固定」寬度。 通過這種方式,您已將表格設置爲至少100%寬,但如果需要它可能會拉伸。 –