Here, the “Why” that you want to do cannot be done.
selector 3 spec updated a bit. The following is taken from this.
“Why” is because :first-letter is a pseudo-element, that is, a “fake” or “false” element. It creates a “fictional tag sequence” that is not recognized in relation to other real elements. So your ...
ul:first-line > li
... suffers from the same problems as this selector string ...
ul:before + li
... where the combinator (whether it be > or + ) looks only at the "element" and not at the "pseudo-element" for selection. The second line does not target the "first" li ul , which follows the :before pseudo-element. If it worked at all, it would target the li that follows ul in the html sequence (which, of course, will never be in a valid html layout).
However, a selector line similar to the previous one will not work in any case , since in fact the form of the specified lines is incorrect, which confirms the statement in the specifications , which says:
Only one pseudo-element can be displayed on the selector, and if it is present it should appear after a sequence of simple selectors that represent the subjects of the selector.
In other words, the pseudo-element can be placed dead last in the selector sequence, since it must be the target of the properties assigned by this selector. Invalid forms seem to be simply ignored just like any invalid selector.
source share