本站有关于CSS3的Media Queries的相关教程有不少,说直一点,就是使用Media Queries来制作Responsiv Desgin。现在国外流行的一种设计叫Responsive Design(国内称为响应式设计),其中这种布局关键之处就是不能少了Media Queries的配合,早在《CSS3 Media Queries模板》一文中就给大家介绍了常用的模板,但有很多评论和论坛中说使用px为单位写响应式布局,会造成断点,那么今天给大家贴上一段使用“em”为单位的Media Queries模板代码片段:
/* ===== == = === 20em (320px) === = == ===== */ @media only screen and (min-width : 20em) { } /* ===== == = === 30em (480px) === = == ===== */ @media only screen and (min-width : 30em) { } /* ===== == = === 37.5em (600px) === = == ===== */ @media only screen and (min-width: 37.5em) { } /* ===== == = === 48em (768px) === = == ===== */ @media only screen and (min-width : 48em) { } /* ===== == = === 56.25em (900px) === = == ===== */ @media only screen and (min-width : 56.25em) { } /* ===== == = === 68.75em (1100px) === = == ===== */ @media only screen and (min-width : 68.75em) { } /* ===== == = === 81.25em (1300px) === = == ===== */ @media only screen and (min-width : 81.25em) { }
同时附上本站有关于Media Queries和Responsive Design的相关教程:
- CSS3 Media Queries
- CSS3 Media Queries模板
- CSS3 Media Queries在iPhone4和iPad上的运用
- CSS3 Media Queries案例——Tee Gallery
- CSS3 Media Queries案例——A List Apart
- CSS3 Media Queries案例——Hicksdesign
- Responsive设计和CSS3 Media Queries的结合
- 了解Responsive网页设计的三个特性
- Responsive设计的关键三步
- 手机上网站导航的制作
- 37个极具创意的响应式布局网站
如需转载,烦请注明出处:http://www.w3cplus.com/codes/Media-Queries-Using-EMs.html