Is there a way in CSS to adjust the style of a parent element, if a nested element exists?
For example, let's say we have a button with padding on the right and left of 10px.
<button>Submit</button>
Now, let's say we add an icon to this:
<button><i class="icon"></i> Submit</button>
Due to the icon, the spacing on the left of the button is too wide. Is there a way without adding an additional class to the button, to say if it contains <i>
, make the padding less on the left?
Thanks!