简体   繁体   English

CSS媒体查询正确大小

[英]css media queries correct sizes

Im developing a site using media queries. 我正在使用媒体查询来开发网站。 the ones that im using are this ones: 我正在使用的是这个:

@media screen and (min-width: 1300px){
@media screen and (min-width: 1024px) and (max-width: 1299px){
@media screen and (min-width: 980px) and (max-width: 1199px){
@media screen and (min-width: 768px) and (max-width: 979px){

the problem that i have is that there are certain screen resolutions in laptops that made the screen look like this: 我的问题是笔记本电脑中存在某些屏幕分辨率,使得屏幕看起来像这样: 在此处输入图片说明

As you can see. 如你看到的。 The navigation section overlaps the main logo and the letters and the bottom go over the main navigation menu. 导航部分与主徽标重叠,字母和底部位于主导航菜单上。 This happens basically on laptops screens that have a very big width and small height. 这基本上发生在宽度和高度都非常小的笔记本电脑屏幕上。 Is there any way that i can target this resolution with media queries? 有什么办法可以通过媒体查询确定此分辨率?

You have this: 你有这个:

@media screen and (min-width: 1300px){
@media screen and (min-width: 1024px) and (max-width: 1299px){
@media screen and (min-width: 980px) and (max-width: 1199px){
@media screen and (min-width: 768px) and (max-width: 979px){

You can do something like this in addition: 您还可以执行以下操作:

@media screen and (min-width: 800px) and (max-width: 900px) {

And just put the elements you need to target inside the media-query. 只需将您需要定位的元素放入媒体查询中即可。 You can have as many media-queries as you'd like and target only the elements you need to. 您可以根据需要选择任意数量的媒体查询,并仅定位所需的元素。

It may be too late now, but I would recommend using min-width only in the future for most of your media-queries so you aren't reproducing some of the same code. 现在可能为时已晚,但是我建议仅在将来对大多数媒体查询使用min-width ,这样您就不会重现某些相同的代码。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM