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.