LILLYROBOT.COM |
This section focuses on some of the properties and values of CSS3.
In the box model section you learnt about the borders width, style and colours. In this section you will learn about the border radius and box shadow.
Border Radius | |
Property | Values |
---|---|
border-top-right-radius | length e.g.25px |
border-bottom-right-radius | length e.g.10px |
border-top-left-radius | length e.g.10px |
border-bottom-left-radius | length e.g.10px |
Displays
Displays
Displays
Box Shadow | |
Property | Values |
---|---|
box-shadow | [x offset, y offset, blur radius, spread radius, color, inset] [length, length, length, length, color, inset] |
Note! The following values can be included or ignored: blur radius, spread radius, color and inset. Have a look at the examples below to help you understand.
Displays
The weather is nice today.
Displays
The weather is nice today.
Displays
The weather is nice today.
A text shadow can be added to the text to make it look more effective. The values are not the same as the box-shadow; it does not have the spread radius and inset values.
Text Shadow | |
Property | Values |
---|---|
text-shadow |
[x offset, y offset, blur radius, color] [length, length, length, color] |
Displays
In this example, we have applied multiple text shadows using a comma to separate them.
Displays
Animation | ||
Property | Values | Description |
---|---|---|
animation-name | none, IDENT | declares the name for the @keyframes animation |
animation-duration | time | the time it takes for an animation to complete a cycle |
animation-delay | time | time it takes to load an element and start of the animation |
animation-direction | normal, alternate | sets the direction of the animation |
animation-iteration-count | number | number of times the animation is repeated |
animation-play-state | running, pauses | states if animation is running or paused |
animation-timing-function | ease (default), linear, ease-in,ease-out, ease-in-out,cubic-bezier(n,n,n,n) | speed curve:time an animation takes to change from style to another |
We have to use the @keyframes rule with the above animation properties. It tells the CSS how the animation is going to work.
If you want to see the animation you will need to refresh your screen by pressing F5.
Displays
Displays
Transition allows you to control the speed of the animation; the change takes place gradually.
Border Radius | ||
Property | Values | Description |
---|---|---|
transition-delay | time | delays the transition of the animation |
transition-duration | time | allows you to set a time on how long you want the transition for |
transition-property | none, all | properties that can be transitioned e.g.width, height,color |
transition-timing-function | ease(default), linear,ease-in, ease-out, ease-in-out,cubic-bezier(n,n,n,n) | controls the pace of the transition |
Displays
Hover your mouse on
LILLY ROBOT to see the transition.
You can write the transition in shorthand for example transition-property:width, transition-duration:2s and transition-timing-function:ease-out can be written as:
transition: width 2s ease-out
Note! We have only included 3 of the transition properties. It is up to you if you want to include all of them.
The order they should appear:
We can include multiple transitions using a comma to separate them.
transition-property: width, height
transition duration:2s, 3s
The transform property allows you to translate, rotate, scale, or skew an element.
Transforms | |
Property | Values |
---|---|
transform-property | translate, rotate, scale, or skew |
Value | Description |
---|---|
translate | An element can be moved left, right, up, or down. We use the translate function translate() e.g translate(20px,30px) moves element 20px from the left and 30px from the top. If we wanted the element to move from the right and from the bottom we use the negative e.g (-20px,-30px). |
rotate | Rotates an element at a specific angle. We use the rotate function() e.g.rotate(90deg)(clockwise) or rotate(-90deg)counter-clockwise. |
scale | Scale (x,y) function - scales the element horizontally and vertically e.g scale(1.5,0.5). |
skew | Tilts an element to the left or right. We can use the skew(x,y) function. If we only wanted to skew an element along the x-axis we can use skewX() e.g skewX(20deg) or if we wanted to skew an element along the y-axis then we use skewY() e.g skewY(20deg). |
Displays
Normal:
Hello
Rotate:
Hello
Displays
Normal:
Hello
Skew:
Hello
Displays
Normal:
Hello
Scale:
Hello
Displays
Normal:
Hello
Translate:Hello