开发者

How to make a site adapt to sizes of phone and iPad screens?

I am working on a new website and have put a set width into my css file. I have a requirement to make the site adaptable and resizable to fit the s开发者_如何学Gomaller screens of phones and various tablet devices.

What in my css styles has to be set so that the site best adapts to the other screen sizes?


You will want to use media queries. This is the whole basis behind responsive design.

@media only screen and (max-device-width: 480px) {
    /* write smartphone styles here */
}

@media only screen and (max-device-width: 768px) {
    /* tablets in portrait mode */
}

@media only screen and (max-device-width: 1024px) {
    /* tablets in landscape mode and smaller/older monitors */
}

Take a look here: http://coding.smashingmagazine.com/2010/07/19/how-to-use-css3-media-queries-to-create-a-mobile-version-of-your-website/

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜