Media queries allow the style to depend upon the meida properties.
CSS 2.1 used media types.(Just "screen" and "print" option).
CSS3布局
CSS 3 increased the capabilities. Style can depend on many features.
width, height, orientation, resolution, ...
Boolean operators can also be applied to increase power.(and/or)
The two query components
A media type(screen, print, all, ...)
The actual query of a media feature and "trigger" size(width, height, orientation, resolution, ...)测试
example: screen and (max-device-width: 480px) and (resolution: 163dpi)
How to implement media queries
Use the @import rule @import url(smallstyle.css) screen and (min-width:600px)
Put media query directly in the style sheet(Mostly used) @media screen and (min-width:500px) {...}
Include query in the link (not good)
Wireframes
Coding after your design.
Wireframe 能够看做布局的草稿,只关注内容和布局
Mobile view is the most important view in web design. 移动视图最重要!
总的来讲就是要提早想好你的页面要怎么根据浏览器大小变化,先设计再动手!
一些 Wireframe 的规则
breakpoints
Size that define a change in your site layout or content.
Used to provide best possible experience for users based on device infomation.
MOBILE FIRST !!
You shouldn't see breakpoints for small screens. The default styling already convers that.
You should have min-width instead of max-width
默认设计时,要按照移动视图来进行设计,其次再考虑更大窗口下的展示方式。
Media Queries - Part 2
Step 1: Grab infomation The meta viewport tag tells mobile browser's viewport how to behave. <meta name = "viewport" content="width=device-width, initial-scale=1">
BAD practice: 加入maximum-scale=1等限制用户自主选择样式的属性。
Step 2: Fluid layout BEST practice: use fluid measurement like percentage/em/rem. paddings and margins affected by width, not height.
Step 3: Media queries Fluid layout that is triggered by certain sizes. ORDERING your rules: default rule always on the top.
## Week 3: Framework
Bootstrap 3.0 benefits
12-column grid system
helps with spacing issues
built-in responsive design
Common jQuery functionalities
Accordion, Dorp-down menus, Carousel
Familiar "look and feel"
Many sites use Bootstrap
Makes your forms look "legitimate"
Bootstrap Breakpoints
Bootstrap hardcodes the breakpoints for different views.