If the element div.PageheaderDescription
does not contain any img
or div#cat-text
, I'd like the height to be set to 0px to eliminate any white space.
Below is my CSS code:
.PageHeaderDescription {
height: 320px;
position: relative;
width: 99%;
}
This is the CSS path being used:
html body div#Container div#Content div.PageHeaderDescription
Here is the HTML snippet:
<div class="PageHeaderDescription">
<img border="0" src="images/Category/large/22.png" class="c1" />
<div id="cat-text" class="c2">
<table>
<tbody>
<tr>
<td>
<h1>1 Person</h1>
</td>
<td><span>test</span></td>
</tr>
</tbody>
</table>
</div>
</div>
Would using jQuery be the best approach? Or could I achieve this using clear:both somehow? I would appreciate your help as I'm unsure how to check for elements within a div using jQuery. Does the function 'contains' only work with strings?