pseudo class css

W3Schools is optimized for learning, testing, and training. To see the active styling, try clicking down on the link below: :pseudo-class-name Simple pseudo-class example. A CSS pseudo-element is used to style specified parts of an element.

What is Pseudo-class. The single-colon syntax was used for both pseudo-classes and pseudo-elements in CSS2 and CSS1. /* Selects any

that is the first element of its type among its siblings */ p:first-of-type { color: red; } Note: As originally defined, the selected element had to have a parent. :active can be used to select an element in its “activated” state. Seit CSS 3 werden alle Pseudoelemente mit zwei vorangestellten Doppelpunkten notiert, damit Pseudoelemente von Pseudoklassen unterschieden werden können. If we wanted to make the first paragraph in an article larger and bold, we could add a class to that paragraph and then add CSS to that class, as shown in the first example below: Examples might be simplified to improve reading and basic understanding.
We use cookies to ensure you have the best browsing experience on our website. CSS pseudo-classes are used to add special effects to some selectors. By using our site, you The :first-of-type CSS pseudo-class represents the first element of its type among a group of sibling elements. To see the active styling, try clicking down on the link below: or accept focus. A pseudo-class is used to define a special state of an element. CSS Pseudo-classes. The element also has an enabled state, in which it can be activated or accept focus. red and in a larger size.In the following example, the first letter of a paragraph will be red, in For Example, changing the style of an element when the user hovers over it, or when a link is visited. It can be combined with a CSS selector to add an effect to existing elements based on their states. It can be combined with a CSS selector to add an effect to existing elements based on their states. So lassen sich zum Beispiel Elemente auswählen, über denen sich gerade der Mauszeiger befindet oder Elemente, die das erste Kindelement eines anderen Elementes sind. The :active pseudo-class is commonly used on and