- From: Markus Ernst <derernst@gmx.ch>
- Date: Tue, 06 Aug 2013 20:06:39 +0200
- To: "www-style@w3.org" <www-style@w3.org>
Am 25.07.2013 20:13 schrieb François REMY:
> For some time already, people advocated for a way to select text nodes using CSS.
>
>
>
> Proposal:
>
> :node-type(x) pseudo-class, whose absence implies the "element" type
> { other values includes "all", "text", "comments"... }
>
> multiple comma-separated arguments are allowed and allows to create union sets
>
>
>
> Use cases include:
>
> - flowing text nodes into a css-region-flow while keeping some siblings out of the flow
>
> .to-flow-into> *:node-type(all) { flow-into: x }
> .to-flow-into> .not-in-flow { flow-into: none }
>
> - hiding text-nodes as part of the continuing content of a document
>
> .read-more ~ *:node-type(all) {display:none})
>
> - coloring them without affecting the other elements inherited color value
>
> .local-blue> *:node-type(text) { color: blue }
>
>
> Thoughts?
<p><span>Text with yellow background on a red rectangle</span><p>
p { background: red }
p span { background: yellow }
In this example, the span element is inserted purely for styling
purposes, which breaks the separation of structure and styling. As I do
not fully understand the use cases discussed so far, I am not sure
whether this is a new use case, though, or a variant of the 3rd one
mentioned above.
Anyway, for this basic use case, a ::text pseudo element would seem more
intuitive to me:
<p>Text with yellow background on a red rectangle<p>
p { background: red }
p::text { background: yellow }
Received on Tuesday, 6 August 2013 18:07:11 UTC