2016-07-11 3 views
0

iPhone 6 및 4를 사용하여 다른 스타일 시트가 적용되고 있는지 확인했습니다. 그렇지 않았습니다. 내 스타일 시트는 다음과 같습니다.왜이 미디어 쿼리가 내 iPhone에서 작동하지 않습니까?

<link rel="stylesheet" media="screen and (max-width: 800px)" href="mobileindex.css"> 
<link rel="stylesheet" media="screen and (min-width: 1100px)" href="desktopindex.css"> 

예, 간격이 있습니다. 그 공간은 나중에 태블릿을위한 공간입니다. 어떤 이유로 mobileindex.css가 해당 설정에 적용되지 않았습니다. 나는 오리엔테이션을 두 번 바꿔야한다. 그러나이 문제는 다음과 같이 수정됩니다.

<link rel="stylesheet" media="screen and (max-width: 1000px)" href="mobileindex.css"> 
<link rel="stylesheet" media="screen and (min-width: 1100px)" href="desktopindex.css"> 

iPhone 4 및 6의 경우 800px로 충분하지 않습니까? 지금 어떻게 작동합니까? 이 문제가 발생한 페이지는 msolonko.net입니다.

+2

는'최대-장치 width'와'분-장치 width'를 사용하여 시도 적이 있습니까? [CSS-Tricks] (https://css-tricks.com/snippets/css/media-queries-for-standard-devices/)에 따르면, 이것이 바로 iPhone을위한 방법입니다. –

+0

@ MarkLanger 그게 효과가있다. 너비 만 사용했을 때 어제까지 작동했고 스타일 시트가 보이지 않기 시작했습니다. –

답변

4

주 스타일 아래에 미디어 쿼리를 추가 한 다음 모바일 장치에서 웹 응용 프로그램을 확인하십시오.

@media screen and (min-width:768px) and (max-width:1024px) { 
    /*Your Mobile Style will be here.*/ 
} 

중요한 것은

는 iPhone6 ​​장치에 대한 잘못된 분 - 폭과 최대 폭을 적용하고 있다는 점이다. 반응 형 디자인을위한 iPhone6의 실제 크기는 다음과 같습니다.

아이폰 6 세로

@media only screen and (min-device-width: 375px) and (max-device-width: 667px) and (orientation : portrait) { 
    /*Your Mobile Style will be here.*/ 
} 

아이폰 6 풍경

@media only screen and (min-device-width: 375px) and (max-device-width: 667px) and (orientation : landscape) { 
    /*Your Mobile Style will be here.*/ 
} 
+0

최대 장치 너비 사용 : 800px 작동합니다. 이제는 800보다 작게 만들 수도 있습니다. 오리엔테이션을 포함해야합니까? –

+0

예, Responsive media queries에 대한 도움이되었습니다. 오리엔테이션을 진행하십시오. –

+0

따라서 일반 지침이 아닌 모든 다른 장치에 대해 별도의 스타일 시트를 만드는 것이 좋습니다. –

관련 문제