Removing span after an anchor

Hi there,

I am trying to remove the span after a specific link in a breadcrumb trail.

This is the span I am trying to remove. I also have the link above it removed through CSS, but I can’t work out how to remove the first span.test only from the code,

I have tried this, but it’s not working:

div.container.breadcrumbs  > span > span  a.job + span.test{
display: none
}

Can anyone help with what I have wrong?

Thank you.

The class name seems to be “Jobs”, not “job”. :wink:

1 Like

is “test” used as a class in a lot of other places?

Is there a reason you can’t just do

.test {
 display: "none";
}

and call it a day?

2 Likes

Thanks for the replies and spotting the typo I’ve changed ot to .Jobs, but still no luck.

the .test class is used in other spans in the breadcrumb chain which is why I need to target just that one, but it needs to be targeted by using the a.jobs link.

I’ve now tried this, but no luck:

div.container.breadcrumbs   span  span  a.Jobs  span.test{
display: none
}

And in the process you lost the + targeting the adjacent span. :wink:

2 Likes

The span.test is not a descendant but a sibling.

<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<title>Untitled Document</title>
<style>
div.container.breadcrumbs  span  span  a.Jobs + span.test{
	display: none
}

</style>
</head>

<body>
<div class="container breadcrumbs">
	<div class="breadcrumb">
		" You are here"
		<span>
			<span>
				<a href="#" class="Jobs">Jobs</a>
				<span class="test">/</span>
				<span>Some other span</span>
			</span>
		</span>
	</div>
</div>  
</body>
</html>

Your first example failed because you had a div as a direct child of the first div.

Your html was also missing a closing div in the image you posted.

Edit:

beaten by Erik :slight_smile:

2 Likes

Then how about just this:

a.Jobs + span.test{
	display: none
}
2 Likes

Thank you :slight_smile:
The + was the thing that made it work

2 Likes

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.