簡體   English   中英

媒體查詢無法在移動縱向模式下工作

[英]Media query not working on mobile portrait mode

將以下內容應用於媒體查詢時,它無法在移動縱向模式下工作。 它適用於移動橫向模式和桌面。 這是我的代碼

 .post-table-new { border-collapse: collapse; border-spacing: 0; width: 100%; display: table; color: #000 } .post-table-new tr, .post-table-new th, .post-table-new td { border: 1.5px solid #000 } .post-table-new { background-color: #fff } .post-table-new td, .post-table-new th { display: table-cell; text-align: center; vertical-align: top } .post-table-new th { background-color: #fe074e; color: #fff } @media only screen and (max-width: 600px) { td.hide-col { display: none; width: 0; height: 0; opacity: 0; visibility: collapse; } th.hide-col { display: none; width: 0; height: 0; opacity: 0; visibility: collapse; } } 
 <meta charset=UTF-8> <meta name=viewport id=viewport content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=no"> <table class="post-table-new"> <tbody> <tr> <th>Heading</th> <th>Heding 2</th> <th class="hide-col">Heding 2</th> </tr> <tr> <td>1</td> <td>2</td> <td class="hide-col">3</td> </tr> <tr> <td>4</td> <td>5</td> <td class="hide-col">6</td> </tr> </tbody> </table> 

在這里,我想隱藏表格的一列。 當縮小瀏覽器的大小時,它在桌面上工作正常。它在移動橫向模式下也能正常工作,但它不能在移動縱向模式下工作。

// add orientation media query, landscape or portrait

@media screen and (max-width: 600px) , screen and (orientation:landscape)

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM