Reputation: 566
I have two objects inside a span; another span, and some text. It is worth noting that the HTML cannot be changed as it is referenced from another website which is read-only.
I need a CSS selector to reference just the text (highlighted in the image below), ignoring the other span — is this possible?
Upvotes: 0
Views: 13374
Reputation: 1
You can do it like this
span{font-size : 15px;} span.comment{font-size:30px;}
//The first style block refers to all spans , whereas the second style block refers to the span with the class of comment and overrides the upper style block.
Upvotes: 0
Reputation: 167182
It may not be possible, but what possible is, reset the styles of the inner span:
span {font-weight: bold;}
span span {font-weight: normal;}
<span>Outside <span>Inside</span> Outside</span>
The above code is making the text alone to be bold, technically leaving the inner span. 😇 You just need to reset the styles of inner span, for all those changes you did with outer ones.
Upvotes: 3