WEBAPP Lesson 6 and 7 - included
WEBAPP Lesson 6 and 7 - included
Responsive Web
And Media Queries
CSS3 Responsive Web Design
Responsive web design provides an optimal experience, easy reading
and easy navigation with a minimum of resizing on different devices such
as desktops, mobiles, and tabs).
Designing For The Best Experience For All Users
Many web pages are based on a grid-view, which means that the
page is divided into columns:
Add a Breakpoint
Example:
Example:
Example:
/* If the screen size is 601px or more, set the font-size of <div> to 80px */
@media only screen and (min-width: 601px) {
div.example {
font-size: 80px;
}
}
/* If the screen size is 600px or less, set the font-size of <div> to 30px */
@media only screen and (max-width: 600px) {
div.example {
font-size: 30px;
}
}
RWD – Images
Add HTML:
Add CSS:
.responsive {
width: 100%;
height: auto;
}
RWD – Images
If you want an image to scale down if it has to, but never scale
up to be larger than its original size, use max-width: 100%:
.responsive {
max-width: 100%;
height: auto;
}
RWD – Images
.responsive {
width: 100%;
max-width: 400px;
height: auto;
}
RWD – Videos
video {
width: 100%;
height: auto;
}
RWD – Videos
video {
max-width: 100%;
height: auto;
}
RWD – Videos
We want to add a video in our example web page. The video will
be resized to always take up all the available space:
video {
width: 100%;
height: auto;
}