台式机,平板电脑,笔记本电脑/笔记本电脑,Iphone和智能手机等所有设备最重要的媒体查询宽度是多少? 这些设备有任何标准宽度吗?
答案 0 :(得分:75)
我正在寻找最佳答案。这就是我找到的。
@media (min-width:320px) { /* smartphones, iPhone, portrait 480x320 phones */ }
@media (min-width:481px) { /* portrait e-readers (Nook/Kindle), smaller tablets @ 600 or @ 640 wide. */ }
@media (min-width:641px) { /* portrait tablets, portrait iPad, landscape e-readers, landscape 800x480 or 854x480 phones */ }
@media (min-width:961px) { /* tablet, landscape iPad, lo-res laptops ands desktops */ }
@media (min-width:1025px) { /* big landscape tablets, laptops, and desktops */ }
@media (min-width:1281px) { /* hi-res laptops and desktops */ }
我认为使用移动优先方法考虑更好。从移动样式表开始,然后应用与其他设备相关的媒体查询。谢谢@ryanve。这是link。
答案 1 :(得分:17)
我发现这些是很好的断点,但始终可以随时测试和调整。我还建议使用ems而不是px来表示不同设备尺寸和分辨率的尺寸(此处描述的原因(http://blog.cloudfour.com/the-ems-have-it-proportional-media-queries-ftw/))
所以上面的查询看起来像这样:
@media (min-width:20em) { /* smartphones, iPhone, portrait 480x320 phones */ }
@media (min-width:30.063em) { /* portrait e-readers (Nook/Kindle), smaller tablets @ 600 or @ 640 wide. */ }
@media (min-width:40.063em) { /* portrait tablets, portrait iPad, landscape e-readers, landscape 800x480 or 854x480 phones */ }
@media (min-width:60.063em) { /* tablet, landscape iPad, lo-res laptops ands desktops */ }
@media (min-width:64.063em) { /* big landscape tablets, laptops, and desktops */ }
@media (min-width:80.063em) { /* hi-res laptops and desktops */ }
这里还有一个漂亮的像素计算器在线计算器(http://pxtoem.com/) 对于那些不熟悉的人,包括我自己。
答案 2 :(得分:4)
尝试此操作包括视网膜
/* Smartphones (portrait and landscape) ----------- */
@media only screen
and (min-device-width : 320px)
and (max-device-width : 480px) {
/* Styles */
}
/* Smartphones (landscape) ----------- */
@media only screen
and (min-width : 321px) {
/* Styles */
}
/* Smartphones (portrait) ----------- */
@media only screen
and (max-width : 320px) {
/* Styles */
}
/* iPads (portrait and landscape) ----------- */
@media only screen
and (min-device-width : 768px)
and (max-device-width : 1024px) {
/* Styles */
}
/* iPads (landscape) ----------- */
@media only screen
and (min-device-width : 768px)
and (max-device-width : 1024px)
and (orientation : landscape) {
/* Styles */
}
/* iPads (portrait) ----------- */
@media only screen
and (min-device-width : 768px)
and (max-device-width : 1024px)
and (orientation : portrait) {
/* Styles */
}
/* Desktops and laptops ----------- */
@media only screen
and (min-width : 1224px) {
/* Styles */
}
/* Large screens ----------- */
@media only screen
and (min-width : 1824px) {
/* Styles */
}
/* iPhone 4 ----------- */
@media
only screen and (-webkit-min-device-pixel-ratio : 1.5),
only screen and (min-device-pixel-ratio : 1.5) {
/* Styles */
}
答案 3 :(得分:1)
试试此媒体查询,它可以帮助您
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/css/bootstrap.min.css" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.2.4/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.js"></script>
<table class="table table-striped table-bordered">
<thead>
<tr>
<th>abc</th>
<th>xyz</th>
</tr>
</thead>
<tbody class="sort">
<tr>
<input class="id" name="id" type="hidden" value="Your Value" />
<td class="center"><span>Text Here</span></td>
<td>Yes, you are done</td>
</tr>
<tr>
<td>Foo</td>
<td>Bar</td>
</tr>
</tbody>
</table>
答案 4 :(得分:0)
完美的媒体查询
makemigrations