0

I wonder if this is possible set the display to none where text is 0, only with CSS without JS

ex:

<span id='counter'>0</span> <!--hide since it is 0-->

 <span id='counter'>1</span> <!--show since it is!=0-->

I know it is possible when it is empty with pseudo :empty

yarek
  • 11,278
  • 30
  • 120
  • 219

1 Answers1

-2

The :empty pseudo-class represents any element that has no children at all. Only element nodes and text (including whitespace) are considered. Comments or processing instructions do not affect whether an element is considered empty or not.

https://developer.mozilla.org/en-US/docs/Web/CSS/%3Aempty

Technically 0 is not empty so pseudo class will not work

Lucky Chingi
  • 2,248
  • 1
  • 10
  • 15