Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CSS: How can I hide a class which has no other class or ID?

Tags:

css

class

So how can I had a td which has only 1 class?

For example:

<td class="ss_label ss_class">Hello</td>
<td class="ss_label">World!</td>

I this case I want to display:none the second one.

This works: $('[class="ss_label"]').hide(); but I don't want to use Javascript or any library such as jQuery. Just pure CSS.

In the real life example, the td I want to hide is the sixth and seventh.

like image 681
jQuerybeast Avatar asked Dec 16 '22 07:12

jQuerybeast


1 Answers

You can use that attribute selector from jQuery in CSS as well:

td[class="ss_label"] { display: none }

This will match a <td> element whose class attribute is exactly "ss_label" with no other additions to it. Works in all major browsers except IE6 (if you consider it a major browser).

like image 106
animuson Avatar answered May 10 '23 19:05

animuson