<td class="col" style="display:none">AAA
<span prop="1" class=" clear-icon " style=""></span>
</td>
I want to use pure css to hide text "AAA" to show span btn. Is there a way to do it in pure css?
The CSS id Selector The id of an element is unique within a page, so the id selector is used to select one unique element! To select an element with a specific id, write a hash (#) character, followed by the id of the element.
The [attribute~=value] selector is used to select elements with an attribute value containing a specified word.
To select all the children of an element except the last child, use :not and :last-child pseudo classes.
If your design is not really responsive, I mean you can just need to set fixed font-size for the inner span
, I think we have a clean solution like this. The idea is to set font-size
of the td
to 0
, it will hide the text node completely:
.col[style*="display:none"] {
display:table-cell!important;
font-size:0;
}
.col > span {
font-size:20px;
}
You can use visibility
property but this will reserve the space for text "AAA":
.col {
visibility:hidden;
}
.clear-icon {
visibility:visible;
}
Also, if you can't remove display:block !important;
from your td
tag just add !important
rule in CSS
.col {
display:block !important;
visibility:hidden;
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With