jisaacstone
jisaacstone

Reputation: 4264

text selectors in css

I am wondering if there are any other selectors which select only part of an HTML element. I know of these two:

:first-letter
:first-line

But AFAIK there are no other selectors which do this. I am interested in any (even browser-specific) selectors or other methods of manipulating only part of a block of text.

The Use Case

I have (more) control over the .css and .js than over the DOM. I've been using js workarounds but want to include any CSS solutions as well, because I don't like to depend of javascript for my styles.

Even if the solution is only supported in konquerer it is still better than nothing IMO.

Upvotes: 1

Views: 668

Answers (2)

GarlicFries
GarlicFries

Reputation: 8323

I'm not aware of any browser-specific pseudo-elements, but there are also the ::before and ::after pseudo-elements. See the CSS 2.1 specification from the W3C.

Upvotes: 1

BoltClock
BoltClock

Reputation: 723448

Nope, those are the only two content pseudo-elements available that select real text nodes. Nothing new has made it into the CSS3 recommendation.

One of the proposals that didn't make it was ::selection (roughly implemented by Opera, Safari and Chrome, and by Firefox as ::moz-selection), but your use case doesn't really say anything about what you want to do so I have no idea if that selector is relevant to your needs.

Upvotes: 4

Related Questions