Formula for converting pixels to percentages
target /context=result
Set the viewport
meta tag in the <head> that tells the browser to set the viewport equal to the width of the screen
<meta name="viewport" content="width=device-width, initial-scale=1">
img {
max-width: 100%;
}
@media screen and (max-width: 800px) {
body{
background-color: green;
}
h1{
font-size: 1em;
}
}
CSS that allows you to apply different styles to different device widths
A breakpoint should be inserted when things start to break apart on your website
Techniques
TESTING
Transitions are used to create basic animation such as a fade in/out on rollover
3 properties are used to create CSS transitions.
transition properties are applied to the a tag
.nav a{
background-color:#ffffff;
transition-property: background-color;
transition-duration: .5s;
}
Since we want to change the background color on hover,
we will use :hover to "trigger" the color change.
.nav a:hover{
background-color:#666666
}
The color will now fade from white to gray when .nav a is rolled over with the mouse.
Shorthand:
transition: (transition-property, transition-duration, transition-timing-function, transition-delay)
Allows you to rotate, scale, relocate, resize, and skew HTML elements. It's similar to the "transform" tool in Photoshop
Applying multiple transforms
transform: scale, rotate, translate