CSS3 position image to center

James Coats
James Coats used Ask the Experts™
on
I can't seem to get the CSS to position my images to the center of the table data tag. Can someone take a look at this please?backyard-example1.html
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Alexandre SimõesManager / Solutions Architect

Commented:
Replace all your style block with this:
table td {
    text-align: center;
}

Open in new window

Here's a working demo
Just be aware that this will apply to all tables in the page.
Probably you want to be a bit more specific when applying styles in order to avoid modifying other other elements unintentionally.
James CoatsComputer Info. Sys. Student

Author

Commented:
Hi Alex,

I just tried the code and it does not work for me or on your link. The text is centered but the image file still goes to the right. I am really having some problems on what seems like a very easy fix.
Manager / Solutions Architect
Commented:
The jsfiddle that I gave you doesn't work for you?

I just updated the example to add a border to the table cells so it's more evident that the image is centered: https://jsfiddle.net/AlexCode/pncsrrrr/embedded/result/

Can you send me a secrrenshot with what you're seeing there?
Can you also attach a couple of pictures you're using so that I can make a proper test case?
James CoatsComputer Info. Sys. Student

Author

Commented:
Alexandre,

That worked perfectly!!

Sam

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial