htmlcsslightgallery

Remove or Display none static text in html code


I want to remove or set css property as display:none for the text element which has no html element or has no id or class attribute. enter image description here Please check image for reference.


Solution

  • You can try font-size: 0 trick.

    div {
      font-size: 0;
    }
    
    div * {
      font-size: 1rem;
    }
    <div>
      <span>text 1</span>
      unwanted text
      <span>text 2</span>
    </div>