04 Responsive Web Design
04 Responsive Web Design
Tablet Phone
Desktop
It is called responsive web design when you use CSS and HTML to resize, hide,
shrink, enlarge, or move the content to make it look good on any screen.
CT053-3-1 Fundamentals of Web Design and Development Responsive Web Design
Viewport
Media
Framework
Queries
Responsive
Web Design
Images/
Grid View
Videos
The width=device-width part sets the width of the page to follow the
screen-width of the device (which will vary depending on the device).
The initial-scale=1.0 part sets the initial zoom level when the page
is first loaded by the browser.
• Users are used to scroll websites vertically on both desktop and mobile
devices - but not horizontally - results in a poor user experience.
• Some additional rules to follow:
– DO NOT use large fixed width elements
• For example, if an image is displayed at a width wider than the viewport it can cause the
viewport to scroll horizontally. Remember to adjust this content to fit within the width of
the viewport.
– DO NOT let the content rely on a particular viewport width to render well
• Since screen dimensions and width in CSS pixels vary widely between devices, content
should not rely on a particular viewport width to render well.
– USE CSS media queries to apply different styling for small and large
screens
• Setting large absolute CSS widths for page elements, will cause the element to be too
wide for the viewport on a smaller device. Instead, consider using relative width values,
such as width: 100%. Also, be careful of using large absolute positioning values. It may
cause the element to fall outside the viewport on small devices.
CT053-3-1 Fundamentals of Web Design and Development Responsive Web Design ‹#›
Media Query
CT053-3-1 Fundamentals of Web Design and Development Responsive Web Design ‹#›
Images/ videos
img, video {
If the width property is set to 100%, the
width: 100%;
image will be responsive and scale up and
height: auto;
down:
}
img, video {
If the max-width property is set to 100%, the
max-width: 100%;
image will scale down if it has to, but never
height: auto;
scale up to be larger than its original size.
}
CT053-3-1 Fundamentals of Web Design and Development Responsive Web Design ‹#›
Frameworks
CT053-3-1 Fundamentals of Web Design and Development Responsive Web Design ‹#›
Frameworks
CT053-3-1 Fundamentals of Web Design and Development Responsive Web Design ‹#›
Advantages and disadvantages
of using frameworks
• Advantages
– Speeds up the mock-up process
– Clean and tidy code
– Solutions to common CSS problems
– Browser compatibility
– Learn good practices
– Having a single procedure to resolve common problems makes maintaining
various projects more straightforward.
– Helpful in collaborative work
• Disadvantages
– Mixes content and presentation
– Unused code leftover (especially when you want to customize the web design)
– Slower learning curve – not good for beginner
– You don’t learn to do it yourself
CT053-3-1 Fundamentals of Web Design and Development Responsive Web Design ‹#›
To use or not to use RWD
framework
• Is it advisable to use a framework?
– Not necessarily. The developer must take the
final decision on whether or not to use a
framework.
– Frameworks are a resource that can be
extremely useful for many people, but that
doesn’t mean they are necessarily useful for
you.
CT053-3-1 Fundamentals of Web Design and Development Responsive Web Design ‹#›
Q&A
CT053-3-1 Fundamentals of Web Design and Development Responsive Web Design ‹#›