Selectors

Last updated on

The :not(X) property in CSS is a negation pseudo class and accepts a simple selector as an argument. Essentially, just another selector of any kind. :not matches an element that is not represented by the argument. The passed argument may not contain additional selectors or any pseudo-element selectors. /* the X argument can be replaced with any simple selectors */ :not(X) {

Continue reading →

Last updated on

The :matches pseudo-class is described as a functional pseudo-class by the official CSS Selectors Level 4 specifications. It doesn’t serve any purpose in itself except making some complex selectors lighter by allowing them to be grouped. In a way, we can think as:matches as syntactic sugar. Basically it keeps you away from repeating a compound selector when there is only one

Continue reading →

Last updated on

The :link selector is a pseudo-class that targets all unvisited anchor () elements on a page. a:link { color: aquamarine; } The example above will change the color of all unvisited links to aquamarine. When used in combination with the :hover pseudo-class, :link must appear first, or else not be defined at all, in order for the :hover styles to work.

Continue reading →

Last updated on

The :last-of-type selector allows you to target the last occurence of an element within its container. It is defined in the CSS Selectors Level 3 spec as a “structural pseudo-class”, meaning it is used to style content based on its relationship with parent and sibling content. Suppose we have an article with a title, several paragraphs and an image:

Continue reading →