In my wordpress post I have image and text mixed. I have the following code which targets content right AFTER an image to apply specific css.
#single-pg p{padding:0 20px; margin-top:0;}
#single-pg img + p{ margin-top:30px; background:red;}
#single-pg img + h1{ background:blue;}
#single-pg img + blockquote{ background:orange;}
I want to be able to do similar with content BEFORE an image (ex. apply margin-bottom: 30px to p) but only when its the last element before an image
Targeting its parent I don't think would solve the issue. I just want to target whatever element comes just before the image, I just cannot pre-determine what that is