Skip to content

Commit 62c987c

Browse files
Merge pull request #328 from maria-logh/gh-pages
CSS Transitions Tutorial
2 parents 4dead66 + 27e3064 commit 62c987c

2 files changed

Lines changed: 62 additions & 0 deletions

File tree

html/lesson5/style.css

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,3 +108,10 @@ a.btn {
108108
padding: 20px 30px;
109109
border-radius: 5px;
110110
}
111+
112+
a.btn:hover {
113+
background: black;
114+
transition-property: background;
115+
transition-duration: 4s;
116+
transition-delay: 1s;
117+
}

html/lesson5/tutorial.md

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -425,6 +425,61 @@ In our case, we only want to change the style of every odd row. Achieving that i
425425

426426
> Try changing odd to even
427427
428+
429+
### Transitions
430+
431+
Let's take some **property** in our code and change it, making it somehow different. E.g. The `background` of the two links named **btn**, and let's change it on hover. This is a 'change'. Now we can have this affect take place during a number of seconds, this is a **Transition**.
432+
Go ahead and add the selector to the stylesheet.
433+
434+
```css
435+
a.btn:hover {
436+
437+
[your property: your value;]
438+
439+
}
440+
```
441+
442+
Add the **property** which we are chaning and its new value:
443+
444+
```css
445+
a.btn:hover {
446+
background: black;
447+
}```
448+
449+
Now create a **Transition** affect:
450+
451+
```css
452+
a.btn:hover {
453+
background: black;
454+
transition-duration: 4s;
455+
}```
456+
457+
Create another one:
458+
459+
```css
460+
a.btn:hover {
461+
background: black;
462+
transition-duration: 4s;
463+
transition-delay: 1s;
464+
}```
465+
466+
467+
468+
469+
470+
471+
472+
473+
474+
475+
476+
477+
478+
479+
480+
481+
482+
428483
## But before we end our lesson
429484

430485
### RGB colors and opacity

0 commit comments

Comments
 (0)