center - CSS left text, centered image in table -


i'm pretty new css , cannot figure out how accomplish following. have tabular data. of data elements have images associated them. want text in cell left justified , want images in same cell centered.

in other words, want same result following except inside table cell.

<p>some text.</p> <img style="display:block;margin-left:auto;margin-right:auto;" src="myimage.jpg"/> 

how can accomplish this? when try placing inside td element, both text , image @ left side.

to use margin center element need have set width:

<p style="text-align: left;">some text.</p> <img style="display:block;margin-left:auto;margin-right:auto; width:200px;" src="myimage.jpg"/> 

also, consider putting styles in external stylesheet , use selectors target elements.


Comments

Popular posts from this blog

java - How to Configure JAXRS and Spring With Annotations -

visual studio - TFS will not accept changes I've made to a Java project -

php - Create image in codeigniter on the fly -