--- title: Mobile Web Development slug: Web/Guide/Mobile tags: - Intermediate - NeedsExample - NeedsTranslation - TopicStub translation_of: Web/Guide/Mobile ---
이 페이지에는 모바일 기기에서도 잘 작동하는 웹 사이트를 디자인하기 위한 몇 가지의 방법과 노하우가 담겨 있습니다. Mozilla Firefox OS 프로젝트에 대한 정보를 찾고 계신다면, Firefox OS 페이지를 참고하세요. 아니면 Firefox for Android에 대한 자세한 정보를 찾아보실 수도 있습니다.
We've organized it into two sections, designing for mobile devices and cross-browser compatibility. Also see Jason Grlicky's guide to mobile-friendliness for web developers.
Mobile devices have quite different hardware characteristics compared with desktop or laptop computers. Their screens are usually smaller, obviously, but they also usually automatically switch the screen orientation between portrait and landscape mode as the user rotates the device. They usually have touch screens for user input. APIs like geolocation or orientation are either not supported on desktops or are much less useful, and these APIs give mobile users new ways to interact with your site.
Responsive Web Design is a term for a set of techniques that enables your web site to adapt its layout as its viewing environment — most obviously, the size and orientation of the screen — changes. It includes techniques such as:
The viewport meta tag instructs the browser to display your site at the appropriate scale for the user's device.
터치 스크린을 사용하려면 당신은 DOM 터치 이벤트에 대해서 배워야 합니다. You won't be able to use the CSS :hover pseudo-class, and will need to design clickable items like buttons to respect the fact that fingers are fatter than mouse pointers. See this article on designing for touch screens.
-moz-touch-enabled 미디어 쿼리를 이용해 터치를 사용할 수 있는 기기에서 다른 CSS 파일을 불러들일 수도 있습니다.
네트워크 속도가 느리거나 비용이 비싼 기기를 사용하는 사용자들을 위해, 디바이스 화면 크기와 해상도에 맞게 최적화된 이미지를 불러들이게 할 수 있습니다. You do this in CSS by querying for screen height, width, and pixel ratio.
You can also make use of CSS properties to implement visual effects like gradients and shadows without images.
Finally, you can take advantage of the new possibilities offered by mobile devices, such as orientation and geolocation.
다양한 모바일 브라우저에서 잘 작동하는 웹 사이트를 만들기 위해서는 다음 내용을 알아두셔야 합니다. :
For example, if you set a gradient as a background for some text using a vendor-prefixed property like -webkit-linear-gradient
, it's best to include the other vendor-prefixed versions of the linear-gradient property. If you don't do that, at least make sure that the default background contrasts with the text: that way, the page will at least be usable in a browser which is not targeted by your linear-gradient
rule.
See this list of Gecko-specific properties, and this list of WebKit-specific properties, and Peter Beverloo's table of vendor-specific properties.
Using tools like CSS Lint can help find problems like this in code, and preprocessors like SASS and LESS can help you to produce cross-browser code.
It's preferable for web sites to detect specific device features such as screen size and touch screens using the techniques listed above, and adapt themselves accordingly. But sometimes this is impractical, and web sites resort to parsing the browser's user agent string to try to distinguish between desktops, tablets, and phones, to serve different content to each type of device.
If you do this, make sure your algorithm is correct, and you aren't serving the wrong type of content to a device because you don't understand a particular browser's user agent string. See this guide to using the user agent string to determine device type.
Test your web site on multiple browsers. This means testing on multiple platforms — at least iOS and Android.