Reputation: 522
I'm trying to write a custom style for a website and am running into a bit of trouble. The following bit of code appears a lot, and I need to remove the float attribute of the span. There are other spans on the page inside <td>
elements with floats that must stay untouched, and CSS doesn't have any parent selectors. I can't edit the html in anyway or add any Javascript. What can I do?
<table class="forum_post box vertical_margin" id="post00001">
<tbody>
<tr class="colhead-dark">
<td colspan="2">
<span style="float: left">
<a class="post_id" href="stuff.com">text</a>
</span>
</td>
</tbody>
</table>
Upvotes: 3
Views: 453
Reputation: 43880
.box > tbody > tr > td > span { float: none !important; }
This says:
Find all
span
s that are the direct descendant (child) of a...td
which is a child of a...tr
which in turn is a child of...tbody
and finally it being the one and only child of...table
OR maybe ...
span[style*="float"] { float: none !important; }
This says:
Any
span
with an attribute ofstyle
containing the wordfloat
. rel *=[external]
Upvotes: 5