Center image in table td in CSS

前端 未结 9 886
萌比男神i
萌比男神i 2021-01-30 19:35

I\'ve been trying to align an image to the center of the table td. It worked with setting margin-left to a specific value but it also increased the size of td too and that isn\'

9条回答
  •  不要未来只要你来
    2021-01-30 20:05

    Simple way to do it for html5 in css:

    td img{
        display: block;
        margin-left: auto;
        margin-right: auto;
    
    }
    

    Worked for me perfectly.

提交回复
热议问题