Is there a way to dynamically change the style of an element through CSS based on the display property of its parent element being set to none?
Take a look at the following HTML:
<div id="mapLinkDiv" class="nav nav-second-level">
<table class="NavSurvey" style="width:180px;">
<tbody>
<tr>
<td>
<a class="fixedResultsLink" href="/QBMapping/QBMap.aspx" title="Map results by State" target="MapByState">Map by State</a>
</td>
</tr>
</tbody>
</table>
<table class="NavSurvey" style="width: 180px; margin-top:10px;">
<tbody>
<tr>
<td style="font-size:12px; text-align:center;">Maps are underdevelopment and may not work properly</td>
</tr>
</tbody>
</table>
</div>
I would like to create a rule that removes the padding-left from all a
tags with the class 'fixedResultsLink' if the parent element, mapLinkDiv, has its display set to none.
Here is the current CSS code on the page:
<style>
a.fixedResultsLink{
padding-left:28px;
}
#mapLinkDiv[style*='display:none'] a.fixedResultsLink {
padding-left:0;
}
</style>
Despite my efforts, I haven't been able to find a solution online. Any suggestions on how to make this work?