1

I am creating a userstyle for mailman/pipermail archives for the Stylish Addon for Firefox and Chrome.

Now the only thing left would be to give the quotes a unique style so I would have to address only text that is preceeded by > and create a CSS for that.

How can I address those text parts with CSS only?

wOxxOm
  • 65,848
  • 11
  • 132
  • 136
rubo77
  • 19,527
  • 31
  • 134
  • 226
  • sounds like you need javascript, as far as I know there is no way to target elements based on their content. I don't suppose the `>` character is wrapped in it's own DOM element? – stackoverfloweth Oct 06 '15 at 12:56
  • Possible duplicate of [Is there a CSS selector for elements containing certain text?](http://stackoverflow.com/questions/1520429/is-there-a-css-selector-for-elements-containing-certain-text) – rubo77 Aug 11 '16 at 01:10

3 Answers3

2

You cannot target element based on their content. You can check the specification.

You can try to use Jquery or Javascript which have functions like td:contains to achieve that.

Rahul Tripathi
  • 168,305
  • 31
  • 280
  • 331
2

Unfortunately you can't using CSS only. As stated from w3schools:

In CSS, selectors are patterns used to select the element(s) you want to style.

Elements being tags. As long as the part you want to style isn't wrapped inside a span for example, you can't style it.

Goowik
  • 782
  • 11
  • 36
0

Looks like they were thinking about such a selector for the CSS3 spec but it didn't make the cut.

:contains() CSS3 selector: https://www.w3.org/TR/2001/CR-css3-selectors-20011113/#content-selectors

rubo77
  • 19,527
  • 31
  • 134
  • 226