I need to remove strings that do not have an html
tag.
For example :
<div class="A">
<a href="#" class="link">keep this</a> and i want to remove this
</div>
Can I do this using only css ?
I need to remove strings that do not have an html
tag.
For example :
<div class="A">
<a href="#" class="link">keep this</a> and i want to remove this
</div>
Can I do this using only css ?
Set the style inside of class "A" to be blank by default. Set up a secondary class to handle ".A a". This will allow you to have two different styles. One for anchored, one for not.
Something like that.
You could use
visibility
:NOTE - of course this DOES NOT remove the string / element in question from the DOM itself, it merely hides it but achieves the same purpose.
You can also use
display: none
with the:not()
pseudo-selectorEDIT: This does not work
Neither does this:
Maybe you can use
font-size
::You can not do this with pure css. If you cannot change the markup, then you will need to use JS to grab the content you want to keep and remove the rest.
If you have any control over the markup you should really consider using different markup. You could have an alternate element that is initially hidden.
you could also enclose the other content you want to remove in a span tag and give it a class that you can reference later.