Scott Scott - 1 month ago 4
CSS Question

Centering an <img> in a <td>

I'm trying to center an image within a table using CSS. Stackoverflow had others with the same problem and solved them using

margin:0 auto, text-align:center
, and/or
display:block
. None of these is forcing the
<img>
to be centered within my table cells.

http://fcilluminateconsulting.com/whats-my-card/

Answer

your img tag is getting float:left property coming from style.css

on line no. 16, add float:none property

table.cards td img {
    border: 1px solid black;
    display: block;
    margin: 0 auto;
    text-align: center;
    float: none; // give this property !
}
Comments