Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

MyirLik's avatar

Display none for a span in a div

Hello, I have a div with the "main" class and in this div I have a span with the "promotion" class. My question is: When I use this type in css, that span is not hidden. How should I do otherwise?

#main > .promotion {
    visibility:none;
}
0 likes
4 replies
automica's avatar

@myirlik

#main > span.promotion {
display: none;
}

if you want to use visibility you should set it as:

visibility: hidden;
MyirLik's avatar

Not work...


#main > span.promotion {
display: none;
}

<div class="main">
	<div class="proditem">
	

	<div class="proditem_cover">
		<a href="" title=" " alt=" "></a>
		<span class="promotion">Test: Test</span>
	</div>
</div>
</div>
			
automica's avatar

Your markup doesn’t match what you asked for help with.

In your code structure you want

.main span.promotion

Please or to participate in this conversation.