-2

e.g. <span data-co="label">Select the elements you do not want to see on this page</span>

as in above span there is no id or class given to span but i need to hide this span

Paulie_D
  • 107,962
  • 13
  • 142
  • 161
Aman Kumar
  • 22
  • 4
  • Maybe. Maybe not. It depends on what about the span, or its relationship to other elements, is unique. Try read the selectors spec and see what matches with your HTML: https://www.w3.org/TR/selectors-3/ – Quentin Dec 19 '18 at 15:25
  • 4
    in css: span[data-co=label] { display: none; } Is one possible solution – Getter Jetter Dec 19 '18 at 15:25
  • Please read the docs before posting a question. What you ask is elementary and easy to find: https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Selectors – Asons Dec 19 '18 at 15:53

1 Answers1

1

As @Olivier Krull mentioned above, you can use an attribute selector to target that span, like so:

span[data-co=label] {
  display: none;
}
<span>This element is visible</span>
<span data-co="label">Select the elements you do not want to see on this page</span>

Of course, that assumes that all the spans you want to hide have that attribute.

T Nguyen
  • 3,309
  • 2
  • 31
  • 48