화면 크기 조정을 위한 미디어 쿼리
다양한 화면 크기에 맞게 웹 레이아웃을 디자인할 때 미디어 쿼리는 필수 도구가 됩니다. 이러한 쿼리를 통해 개발자는 화면 너비에 따라 레이아웃을 조정하는 방법을 지정할 수 있습니다.
특정 화면 크기에 대한 미디어 쿼리 적용
특정 화면 크기를 대상으로 하려면 다음과 함께 미디어 속성을 사용하세요. 최대 너비 속성. 예를 들어 너비가 800px 미만인 화면에 스타일을 적용하려면 다음을 사용하세요.
@media screen and (max-width: 800px) { /* Styles for screens less than 800px wide */ }
제공된 코드 샘플 사용
제공된 코드 샘플은 다음 미디어 쿼리를 사용합니다.
/* Smartphones (portrait and landscape) */ @media only screen and (min-device-width : 320px) and (max-device-width : 480px) { /* Styles for smartphones in portrait and landscape */ } /* Smartphones (landscape) */ @media only screen and (min-width : 321px) { /* Styles for smartphones in landscape */ } /* Smartphones (portrait) */ @media only screen and (max-width : 320px) { /* Styles for smartphones in portrait */ } /* iPads (portrait and landscape) */ @media only screen and (min-device-width : 768px) and (max-device-width : 1024px) { /* Styles for iPads in portrait and landscape */ } /* iPads (landscape) */ @media only screen and (min-device-width : 768px) and (max-device-width : 1024px) and (orientation : landscape) { /* Styles for iPads in landscape */ } /* iPads (portrait) */ @media only screen and (min-device-width : 768px) and (max-device-width : 1024px) and (orientation : portrait) { /* Styles for iPads in portrait */ } /* Desktops and laptops */ @media only screen and (min-width : 1224px) { /* Styles for desktops and laptops */ } /* Large screens */ @media only screen and (min-width : 1824px) { /* Styles for large screens */ } /* iPhone 4 - 5s */ @media only screen and (-webkit-min-device-pixel-ratio : 1.5), only screen and (min-device-pixel-ratio : 1.5) { /* Styles for iPhone 4 - 5s */ } /* iPhone 6 */ @media only screen and (max-device-width: 667px) only screen and (-webkit-device-pixel-ratio: 2) { /* Styles for iPhone 6 */ } /* iPhone 6+ */ @media only screen and (min-device-width : 414px) only screen and (-webkit-device-pixel-ratio: 3) { /* Styles for iPhone 6+ */ } /* Samsung Galaxy S7 Edge */ @media only screen and (-webkit-min-device-pixel-ratio: 3), and (min-resolution: 192dpi)and (max-width:640px) { /* Styles for Samsung Galaxy S7 Edge */ }
이러한 미디어 쿼리는 스마트폰, 태블릿, 대형 화면 등 다양한 화면 크기를 포괄합니다.
추가 고려 사항
다양한 화면 크기에서 유연성을 높이려면 픽셀 대신 em 값을 사용하는 것이 좋습니다. 자세한 지침은 Zell Weekley의 "미디어 쿼리 단위" 기사를 참조하세요.
위 내용은 미디어 쿼리는 다양한 화면 크기에 맞는 반응형 웹 사이트를 디자인하는 데 어떻게 도움이 됩니까?의 상세 내용입니다. 자세한 내용은 PHP 중국어 웹사이트의 기타 관련 기사를 참조하세요!

자신의 코드를 리팩터링하는 것은 어떤 모습입니까? John Rhea는 자신이 쓴 오래된 CSS 애니메이션을 선택하고 최적화하는 사고 과정을 살펴 봅니다.

cssanimationsarenherinly에 hardbutreepracticenderstandingofcsspropertiesandtimingflestions.1) startsimpleants withsimpleatslikeScalingabuttononHoverusingKeyframes.2) useAsingfuctionslikecubic-bezierfornateffects, 그러한 분위기, 3)

@keyframesispopularduetoitstativerstatility 및 powerincreatingsmoothcssanimations.keytricksinclude : 1) states 사이에 moothtransitionsbettites, 2) 애니메이션 multiplepropertiessimultory, 3) vendorPixesforBrowsercompatibility, 4) 빗질을 사용하여

csScounterSearedTomanageAutomaticNumberingInberingInwebDesigns.1) 1) theCanbeusedfortablestoffContents, ListItems 및 CustomNumbering.2) AdvancedUsesInSinestedNumberingsystems.3) CreativeUseNvolvecust를 CreativeSinvolecust.4) CreativeSinvolvecust

특히 모바일 장치에 스크롤 그림자를 사용하는 것은 Chris가 이전에 다룬 미묘한 UX입니다. Geoff는 애니메이션 타임 라인 속성을 사용하는 새로운 접근 방식을 다루었습니다. 또 다른 방법이 있습니다.

빠른 새로 고침을 통해 실행합시다. 이미지 맵은 html 3.2로 돌아가는데, 먼저 서버 측 맵과 클라이언트 측지 맵은 맵 및 영역 요소를 사용하여 이미지를 통해 클릭 가능한 영역을 정의했습니다.

Devs State Survey는 이제 참여에 개방되어 있으며, 이전 설문 조사와 달리 코드, 직장, 건강, 취미 등을 제외한 모든 것을 포함합니다.

CSS 그리드는 복잡하고 반응이 좋은 웹 레이아웃을 만드는 강력한 도구입니다. 디자인을 단순화하고 접근성을 향상 시키며 이전 방법보다 더 많은 제어를 제공합니다.


핫 AI 도구

Undresser.AI Undress
사실적인 누드 사진을 만들기 위한 AI 기반 앱

AI Clothes Remover
사진에서 옷을 제거하는 온라인 AI 도구입니다.

Undress AI Tool
무료로 이미지를 벗다

Clothoff.io
AI 옷 제거제

Video Face Swap
완전히 무료인 AI 얼굴 교환 도구를 사용하여 모든 비디오의 얼굴을 쉽게 바꾸세요!

인기 기사

뜨거운 도구

SublimeText3 영어 버전
권장 사항: Win 버전, 코드 프롬프트 지원!

SublimeText3 Linux 새 버전
SublimeText3 Linux 최신 버전

Eclipse용 SAP NetWeaver 서버 어댑터
Eclipse를 SAP NetWeaver 애플리케이션 서버와 통합합니다.

SublimeText3 Mac 버전
신 수준의 코드 편집 소프트웨어(SublimeText3)

안전한 시험 브라우저
안전한 시험 브라우저는 온라인 시험을 안전하게 치르기 위한 보안 브라우저 환경입니다. 이 소프트웨어는 모든 컴퓨터를 안전한 워크스테이션으로 바꿔줍니다. 이는 모든 유틸리티에 대한 액세스를 제어하고 학생들이 승인되지 않은 리소스를 사용하는 것을 방지합니다.