9. Pseudo-classes: hover and focus
ستتم ترجمة هذا المقال تلقائيًا. يُعرض بالإنجليزية حاليًا.
A pseudo-class styles an element in a particular state. :hover applies while the mouse is over an element. :focus applies when the element is selected with the keyboard. :first-child picks the first child.
Always style :focus too, so keyboard users can see where they are.
عرض المثال
a:hover {
text-decoration: underline;
}
button:focus {
outline: 3px solid orange;
}
✍️ دورك الآن
Make .btn change its background to orange when hovered.