jimmyshoes
Programmer
Is the following the correct way to center text on an image
I have been experimenting with this. the surrounding <p> takes on the height of the image and the text aligns to the image depending on the vertical-align
What seems slightly odd to me is that the TEXT seems to respond to the styling on the IMAGE. I would have expected to have had to apply a style to the text itself to get this behaviour
Code:
<p style="border:1px solid #ffffff">Text<img src="1.jpg" style="vertical-align:middle"/></p>
I have been experimenting with this. the surrounding <p> takes on the height of the image and the text aligns to the image depending on the vertical-align
What seems slightly odd to me is that the TEXT seems to respond to the styling on the IMAGE. I would have expected to have had to apply a style to the text itself to get this behaviour