반응형
iPad에서 Portrait & Landscape 일때 적용 CSS 예제
http://catharsis.tumblr.com/post/501657271/ipad-orientation-css-revised
http://catharsis.tumblr.com/post/501657271/ipad-orientation-css-revised
iPad Orientation CSS (Revised)
It doesn’t take much foresight to anticipate that with the rise of Natural User Interfaces (NUIs) like the iPhone and iPad, UI designers will have a greater responsibility to optimize for orientation-based contexts. As such, it’s quite prescient that today, the folks at Cloud Four demonstrated how to serve up stylesheets based on device orientation.
Since I have a feeling I’ll be using this quite a bit in the future, I wanted to build on Cloud Four’s work and find a way to alleviate the following issues:
- Extra HTTP requests
- Not iPad-specific
- Lack of reusability
So, without further ado, here’s my proposed revision to the iPad orientation CSS:
<!-- css -->
@media only screen and (max-device-width: 1024px) and (orientation:portrait) {
.landscape { display: none; }
}
@media only screen and (max-device-width: 1024px) and (orientation:landscape) {
.portrait { display: none; }
}
<!-- example markup -->
<h1 class="portrait">Your device orientation is "portrait"<h1>
<h1 class="landscape">Your device orientation is "landscape"<h1>
As you can see, I’ve also changed the markup in a predictable way. An explanation of the changes and the reasoning behind them can be found below.
반응형
'프로그래밍 > Style & Design' 카테고리의 다른 글
Safari Reader - 사파리 읽기도구 (0) | 2012.04.26 |
---|---|
http://css-infos.net/ CSS 정보 (0) | 2012.03.28 |
CSS sprites 기법 (0) | 2011.11.23 |
[WEB] 35 inspiring light and white website designs (0) | 2011.08.25 |
[Web] The Top 8 Placeholder Services for Web Designers (0) | 2011.04.13 |