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

Detect support for Shoutcast ICY MP3 without navigator.userAgent in Firefox? -

web - SVG not rendering properly in Firefox -

java - JavaFX 2 slider labelFormatter not being used -