I'm trying to get a CSS selector for <img>
elements on their own line but not an in-line <img>
. So it should match (example 1):
<p><img src="..."></p>
but not (example 2):
<p>Lorem <img src="..."> ipsum</p>
I tried img:only-child
-- because if the text is a text node surely this shouldn't match example 2. But it does.
Why? I want margins for in-line images (example 2) but no margins for images on their own line (example 1).
Is there any way to achieve this?
`? Or you could just add a class for inline vs standalone.
– DBS Nov 17 '21 at 10:12via the source view but most users couldn't.
– Leon S. Nov 17 '21 at 10:30