2017-04-13 22 views
0

我有一個表,這裏是我的CSS:表顯示塊不是媒體查詢工作

table { 
display: block; 
height: 500px; 
overflow-y: scroll; 
} 

當我加入這個內嵌它是確定,但在外部不工作(在媒體查詢最大寬度767px)

編輯|我的媒體查詢

@media(max-width:767px) { 
table { 
    display: block; 
    height: 500px; 
    overflow-y: scroll; 
} 
} 
+0

您可以包括您遇到問題的媒體查詢? – GvM

+0

這裏是編輯問題 – Volkan

+0

是你的媒體查詢在CSS樣式的底部? – GvM

回答

0

嘗試將您的表放入div包裝中。像這樣:

<div class='table-container'> 
    <table></table> 
</div> 

然後在你的CSS簡單的設置

.table-container > table { 
    height:100%; 
    width: 100%; 
} 

.table-container { 
    height: 500px; 
} 

看到這個fiddle