html - working - What does this operator(::) in CSS mean?

what's before and after (4)

Google is your friend here.


Pseudo-elements create abstractions about the document tree beyond those specified by the document language. For instance, document languages do not offer mechanisms to access the first letter or first line of an element's content. Pseudo-elements allow authors to refer to this otherwise inaccessible information. Pseudo-elements may also provide authors a way to refer to content that does not exist in the source document (e.g., the ::before and ::after pseudo-elements give access to generated content).

A pseudo-element is made of two colons (::) followed by the name of the pseudo-element.

This :: notation is introduced by the current document in order to establish a discrimination between pseudo-classes and pseudo-elements. For compatibility with existing style sheets, user agents must also accept the previous one-colon notation for pseudo-elements introduced in CSS levels 1 and 2 (namely, :first-line, :first-letter, :before and :after). This compatibility is not allowed for the new pseudo-elements introduced in this specification.

Found at

This question already has an answer here:

I have seen CSS like Custom Scrollbars in WebKit

body::-webkit-scrollbar {
    width: 10px;
    height: 13px;
    background-color: white;
    color: #EBEBEB;

This specifies CSS for WebKit browsers. But what does this operator (::) mean in CSS?

Where can I find other such operators in CSS?

In css3 we use double colon(::) for pseudo-element & single colon(:) for pseudo-class

The single colon syntax (e.g. “:before” or “:first-child”) is the syntax used for both pseudo-classes and pseudo-selectors in all versions of CSS prior to CSS3. With the introduction of CSS3, in order to make a differentiation between pseudo-classes and pseudo-elements (yes, they’re different), in CSS3 all pseudo-elements must use the double-colon syntax, and all pseudo-classes must use the single-colon syntax.

Read this article

It is used to define a pseudo-element. As an example from the documentation:

p::first-line { text-transform: uppercase }

This modifies the first line of p elements. There's no real DOM element that is selected, that is why it is a pseudo-element.

In your case, it modifies scrollbars in WebKit within the body element:


There is no scrollbar element within your document but this still allows you to style scrollbars within your HTML page.

Thought I'd add this since people are having difficulty understanding what it actually means:

Basically it's a way to get a document to format in a way that wouldn't be possible using the markup that is present. A good example exists in the W3 spec:

Here is the example for a ::first-letter pseudo element

The original HTML fragment

<p>The first text.

The fictional markup after the pseudo element is applied

<p><div::first-letter><p::first-letter>T</...></...>he first text.

As you can see - the original HTML specified a div and a p, but there is no way to format the first letter using standard CSS, so the pseudo elements were added, enabling the first letter to be modified

Psuedo elements allow you to do stuff like that..