difference between class and pseudo-class in css

The differences between pseudo-class and ordinary class are:

  • We can use any string for a class but we cannot use any string for a pseudo-class. Pseudo-classes are predefined. They are: last-child, only-child, invalid,hover, focus, visited, etc.
  • In a selector, we prefix a dot for a class while we prefix a colon for a pseudo-class.
  • We need to specify a class in the class attribute of an element to apply the css rule including the class selector to the element. But we shall not write a pseudo-class in the class attribute of an element. A css rule including a pseudo-class selector will automatically apply to all elements selected by that selector. pseudo-class selectors can be used independently, or combined with other selectors.
Did you like this?
Tip admin with Cryptocurrency

Donate Bitcoin to admin

Scan to Donate Bitcoin to admin
Scan the QR code or copy the address below into your wallet to send some bitcoin:

Donate Bitcoin Cash to admin

Scan to Donate Bitcoin Cash to admin
Scan the QR code or copy the address below into your wallet to send bitcoin:

Donate Ethereum to admin

Scan to Donate Ethereum to admin
Scan the QR code or copy the address below into your wallet to send some Ether:

Donate Litecoin to admin

Scan to Donate Litecoin to admin
Scan the QR code or copy the address below into your wallet to send some Litecoin:

Donate Monero to admin

Scan to Donate Monero to admin
Scan the QR code or copy the address below into your wallet to send some Monero:

Donate ZCash to admin

Scan to Donate ZCash to admin
Scan the QR code or copy the address below into your wallet to send some ZCash:

Leave a Reply