Normally you would do this with a stylesheet, but this is for a newsletter so have to use inline styles.
The newsletter contains several blocks wrapped in a div with the tmp class. The content will be placed inside this div, with possibly 1 image. This image is where I want to add an inline style to.
This code bellow works as long as there is no <p> in the same div. But once you add some text to it, it stops working. Obviously there will be text in a newsletter. I got this code form another form, i tried to play around with the code a bit to get it to work, but no success so far.
If you would remove the <p> from the $str, it does work fine. But I want to work with multiple <p> after the img. Any idea’s on how to make this work with <p> after the image?
I would love to us a normal sylesheet, but as far as I know there are some mail clients that strip it out, I think gmail was one of them that takes out css files. So no other option then to use inline style.
In your op you didn’t mentioned the newsletter was being emailed. I assumed it was a newsletter just for publishing on a web page which people can link to. In that case then yes, you have to think way retro for html emails and so inline styles is the way to go.