Category CSS

CSS :valid and :invalid

CSS :valid and :invalid pseudo classes example

The :valid in CSS is a pseudo class that allows you to select an <input> element whose content is correct, based on its type. In other words, this pseudo class selects an <input> element whose content meets the criteria specified…

Pseudo Classes in CSS

Syntax to define Pseudo classes in CSS

In addition to type selectors and class selectors, CSS also allows pseudo-classes to style elements based on dynamic events, a change in state, or other conditions present in the HTML document that are not easily accomplished through other ways. For…

Attribute Selector in CSS

An example of equality or attribute value selector in CSS.

The attribute selector in CSS allows you to select those HTML elements that have a specified attribute or attribute-value pair. For example, em[lang]{ color: red; } will apply to all <em> elements that have a “lang” attribute. This selector applies…

General Sibling Selector in CSS

An example of general sibling selector for applying multiple types of element.

The general sibling selector in CSS allows you to select all the elements that are a sibling of another element, regardless of their type. In other words, the general sibling selector matches elements that are sibling of the specified element,…

Adjacent Sibling Selector in CSS

An example of adjacent sibling selector with different elements.

An adjacent sibling selector in CSS selects that element that is the next sibling of another element. Here, the term “sibling” refers to elements that share the same parent element within an HTML document structure. Thus, sibling elements are elements…