2. Objectives
Developing a website in a way that allows the layout
to adjust according to the user’s screen resolution by
using:
1. A flexible, grid-based layout
2. Relative unit in typography (% and em)
3. A flexible media (image, video …)
4. Media Query (CSS3)
3. Prerequisites
Basic CSS, HTML Knowledge
Have ability to convert PSD to normal website have
fixed width
4. Outline
What is Responsive Web Design?
Viewport and meta tags for mobile browser
How to make Responsive Web?
1. Mobile-first strategy
2. Typography
3. Flexible, grid-based layout
4. Flexible media (image, video)
5. Media Query (CSS3)
13. What is Responsive Web
Design (RWD)?
One version of a website can scale responsively to
fit on different platforms.
Must work with any form of information
Accessible from any device.
15. Pros & Cons
Pros:
Good for SEO
Single URL for desktop and mobile. No redirection
Content parity. No duplicated content
Easy for maintenance
Adapt with universal devices
Cons:
Slower performance if you have poor implementation
16. Terms you have to know
Adaptive
Responsive
Fluid >< Fixed-Width
Breakpoint
Mobile-First
17. How to become
Responsive?
1. Mobile-First
2. Viewport setting
3. Relative Typography
4. Flexible Grid
5. Flexible Image, Video …
6. Flexible Media Query
7. Compress content where possible, and avoid sending
unnecessary data
18. Mobile-First
The idea is to start by considering the simplest
possible version (usually the mobile version) and
work up through larger and more complex designs
Emphasis on core content and design elements
(typography and colours, then layout, etc).
28. Relative Typography
We are using em/rem/% instead of px for font size
and spacing.
Need an easier way, check this out:
http://pxtoem.com/
http://responsv.com/flexible-math/
39. Media Query
What is Media Query?
Browser Support? How does media query work with
old-browsers (such as IE8 and below) ?
40. What is Media Query ?
We can adapt our design to specific range of
devices without changing the content
CSS 2.1
41. What is Media Query ?
CSS 3
Remember set viewport meta tags
42. Media Query - Browser
Support
Media Query for non-support browsers (<= IE8)
https://code.google.com/p/css3-mediaqueries-js/
https://github.com/scottjehl/Respond
https://github.com/pyrsmk/mediatizr
50. Question?
Can we replace max/min-width by max/min-device-
width?
Will browsers download all CSS files when using
media queries in <link> tags?
http://adapt.960.gs/: to save HTTP requests.
Should we arrange CSS file or media queries in an order
?
51. Flexible Image: Level 1
If you want to support flexible images in old-browers,
use a small script to fix:
http://unstoppablerobotninja.com/entry/fluid-images
55. Fluid Video
How to import video into website:
HTML5 <video> tag
Using <iframe>, ex: YouTube or Vimeo
<object>/<embed> tags to display a Flash player
58. Responsive for old
browsers
Media Query for non-support browsers (<= IE8)
https://code.google.com/p/css3-mediaqueries-js/
https://github.com/scottjehl/Respond
https://github.com/pyrsmk/mediatizr
HTML 5 tags for <= IE8: html5shiv (html5shim)
REM unit polyfill: https://github.com/chuckcarpenter/REM-
unit-polyfill
59. Enhancement
Use CSS transition to resize smoothly:
http://elliotjaystocks.com/blog/css-transitions-media-queries/
Responsive Data Table: http://css-tricks.com/responsive-data-tables/
http://responsejs.com/
60. Tool
Test Web
http://responsivepx.com/
http://mattkersley.com/responsive/
http://www.responsinator.com/
http://responsive.is/anderssonwise.com
http://screenqueri.es/
http://quirktools.com/screenfly/
63. Summary: How to become
Responsive?
1. Mobile-First
2. Viewport setting
3. Relative Typography
4. Flexible Grid
5. Flexible Image, Video …
6. Media Query
7. Compress content where possible, and avoid sending
unnecessary data
Only optimized for small screens‣ Need to provide all content‣ content has to be managed twice‣ Issues when sharing content‣ Pretty expensive for an unsatisfying result
Which platforms will you support?(iOS, Android, WindowsPhone)‣ Each update:- cost per platformmight take time (approval)What about search engines?‣ Your content won’t be indexed by themlinks to websites open in a new app (!)‣ no native browser functions :(bookmarking!)non selectable text (no copy-paste)‣ App’s often have their own interface language