Jump to content

Cascading Style Sheets/Interactivity

From Wikibooks, open books for an open world

Elements can be made interactive by using hover effects, transitions and animations.

Hover effects

[edit | edit source]

Elements can have a different effect (i.e. changing background, size, applying shadows).

Examples

[edit | edit source]

Changing colors

[edit | edit source]
#css-button1 {
    background: #6c9;
}
#css-button1:hover {
    background: #4a7;
}
A button

Changing size

[edit | edit source]
#css-button2 {
    transform: scale(1);
}
#css-button2:hover {
    transform: scale(1.2);
}
Another button