Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Manipulating CSS styles of pseudo elements in Firebug

Is is possible to manipulate CSS of pseudo element :before or :after using Firebug? I know these are specific elements that are handled internally by browsers but Firebug has more low level access (I suppose) so maybe it has the ability to manipulate these as well.

like image 473
Robert Koritnik Avatar asked Mar 28 '11 12:03

Robert Koritnik


People also ask

What is a CSS pseudo element?

A CSS pseudo-element is a keyword added to a selector that lets you style a specific part of the selected element(s). For example, ::first-line can be used to change the font of the first line of a paragraph.

What is pseudo-class and pseudo element in CSS?

Pseudo-classes enable you to target an element when it's in a particular state, as if you had added a class for that state to the DOM. Pseudo-elements act as if you had added a whole new element to the DOM, and enable you to style that.

How do you inspect pseudo-elements?

In Chrome's Dev tools, the styles of a pseudo-element are visible in the panel: Otherwise, you can also input the following line in the JavaScript console, and inspect the returned CSSStyleDeclaration object: getComputedStyle(document. querySelector('html > body'), ':before');

Can we create pseudo-elements in inline CSS?

You can't specify inline styles for pseudo-elements. This is because pseudo-elements, like pseudo-classes (see my answer to this other question), are defined in CSS using selectors as abstractions of the document tree that can't be expressed in HTML.


1 Answers

You can edit a stylesheet in the CSS tab and

  • add new rules for pseudo-elements
  • alter existing pseudo-element rules

However, I can't find any pseudo-element styles in the computed styles panel. Probably because the styles don't apply to the elements but rather their contained pseudo-elements. Neither can I find a way to inspect pseudo-elements using Firebug.

like image 118
BoltClock Avatar answered Oct 07 '22 07:10

BoltClock