user3432211
user3432211

Reputation: 21

Hide a tag after span css

I need to hide <a> tag coming after <span> there is no class available on <a> and I am working on a script coming from third party so i just need to hide <a> script using css, I have no much knowledge about css so please let me know. I think this can be done using css.

<span class = "hidea">abc</span>
<a href = ""> hide me </a>

Upvotes: 0

Views: 145

Answers (3)

Tushar Gupta
Tushar Gupta

Reputation: 15913

You can use the adjacent sibling selector (+) which will select the specified element that immediately follows the former one

.hidea + a { display: none; }
<span class = "hidea">abc</span>
<a href = ""> hide me </a>

Upvotes: 0

Dhaval Marthak
Dhaval Marthak

Reputation: 17366

You can use adjacent siblings selector

.hidea + a{
   display:none;
}

Upvotes: 1

Fabrizio Calderan
Fabrizio Calderan

Reputation: 123377

use the adjacent sibling selector (+)

.hidea + a { display: none; }

From https://developer.mozilla.org/en-US/docs/Web/CSS/Adjacent_sibling_selectors

[...] It will select only the specified element that immediately follows the former specified element.

Upvotes: 2

Related Questions