Michael Gruber
Michael Gruber

Reputation: 601

Is there a way to hide text following tags with CSS?

I have <div><strike>Stuff I want</strike> Stuff I don't want</div>. It is what it is. No way around it.

Is there a way I can hide the "Stuff I don't want" with CSS?

Like for example I can show the "Stuff I don't want" alone easily enough. with a .strike { display: none; } but is there a way to show only the "Stuff I want'?

Upvotes: 0

Views: 82

Answers (1)

Explosion Pills
Explosion Pills

Reputation: 191729

div { font-size: 0; }
strike { font-size: 10px; }

Better:

div { visibility: hidden; }
strike { visibility: visible; }

Upvotes: 2

Related Questions