Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there any way to inspect ::first-line and ::first-letter pseudo-elements in developer tools?

The ::first-line and ::first-letter pseudo-elements, as their names suggest, allow you to style the first letter and first line of an HTML element.

However, I can't find any way to inspect these styles in a browser's developer tools. Other pseudo-elements and pseudo-classes (like ::before, ::after, :first-child, etc) are readily inspectable in dev tools via "Inspect element", but I can't find a way to inspect ::first-letter or ::first-line. Is there a way that I'm missing, or is this not currently possible?

like image 607
Nick F Avatar asked Feb 19 '19 20:02

Nick F


People also ask

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 I use :: first letter?

::first-letter (:first-letter) The ::first-letter CSS pseudo-element applies styles to the first letter of the first line of a block-level element, but only when not preceded by other content (such as images or inline tables).

What is :: before in inspect element?

::before is a generated content element that represents a styleable abstract first child of the respective element. The content inserted using ::before is inserted before other content inside the element and is displayed inline by default. The value of the content is specified using the content property.

Is the first line a pseudo-element?

::first-line is a pseudo-element used to select the first formatted line in a block-level element (such as a paragraph <p> ).


2 Answers

1. Firefox (64 and Nightly) I was able to easily see both ::first-line and ::first-letter pseudo-elements in the Firefox inspector:

enter image description here.

You can see those styles in your inspector by expanding the 'pseudo-elements' tab: enter image description here

2. Chrome (72) I have no trouble seeing it in the Chrome inspector either (applies to both ::first-line and ::first-letter):

enter image description here

Was not able to find the pseudo-element in Safari.

like image 191
Helenesh Avatar answered Oct 06 '22 01:10

Helenesh


In Chrome (74), I see these styles listed all the way at the bottom of the styles list, past the Inherited from blocks: chrome inspector pseudo classes

like image 30
nvioli Avatar answered Oct 06 '22 01:10

nvioli