You cannot put a <div> inside a <p>. That's not valid code. And also, the code you have is just really poor code.
Code:
<p class="group1"><img src="exampleimage" alt="example" /></p>
That is valid code and you can just put all the styling you want in group1.