This translation is incomplete. Please help translate this article from English

Um pseudoelemento de CSS é uma palavra-chave adicionada ao seletor que lhe permite estilizar uma parte específica do(s) elemento(s) selecionado(s). Por exemplo, ::first-line pode ser utilizado para alterar o tipo de letra da primeira linha de um parágrafo.

/* The first line of every <p> element. */
p::first-line {
  color: blue;
  text-transform: uppercase;

Nota: In contrast to pseudo-elements, pseudo-classes can be used to style an element based on its state.


selector::pseudo-element {
  property: value;

You can use only one pseudo-element in a selector. It must appear after the simple selectors in the statement.

Note: As a rule, double colons (::) should be used instead of a single colon (:). This distinguishes pseudo-classes from pseudo-elements. However, since this distinction was not present in older versions of the W3C spec, most browsers support both syntaxes for the original pseudo-elements.

Índice de pseudoelementos padrões

Navegador Versão Mais Baixa Suporta
Internet Explorer 8.0 :pseudo-element
9.0 :pseudo-element ::pseudo-element
Firefox (Gecko) 1.0 (1.0) :pseudo-element
1.0 (1.5) :pseudo-element ::pseudo-element
Opera 4.0 :pseudo-element
7.0 :pseudo-element ::pseudo-element
Safari (WebKit) 1.0 (85) :pseudo-element ::pseudo-element

Consultar também: