简体   繁体   中英

Image Alt Tags/caption default align left. How can I change to center

I am working on email templates. where images are not shown default by email client. so I am using alt text for it. Now problem is that, Alt text is defalut to left. I want to be center. I tried with text-align:center but it will not work.

Following tried code

<img align="center" alt="photogurus" src="https://ci5.googleusercontent.com/proxy/MXtyd6DfKf03Jiqd90hiDo5DaCOXIuoYNLAV4T2ugpS_Z--fbEJUINKvb13AFv9Cqks5MlOuZ6oTtuo58hPvrOg6fhBJedH6_IH6Ta1pEWYGS5LfE8rF_qa-06EBga2JqJNRy3KfQpKf4Lj7ApkcHTsDDO0VzFFeYB3ICy8=s0-d-e1-ft#https://gallery.mailchimp.com/283f05b120a2d42944ac78377/images/5df4bc72-44bc-4f2a-94bb-0e1967374984.png" width="76" style="text-align:center;font-size: 11px;max-width: 76px;padding-bottom: 0;display: inline!important;vertical-align: bottom;border: 0;min-height: auto;outline: none;text-decoration: none;height: auto !important;-ms-interpolation-mode: bicubic;color:#fcbb2a;" class="CToWUd">

Create a table and place the image in it:

<table cellspacing="0" style="width:300px;height:300px;border:1px solid black;">
   <tr>
     <td style="text-align:center;">
       <img align="center" alt="photogurus" src="https://ci5.googleusercontent.com/proxy/MXtyd6DfKf03Jiqd90hiDo5DaCOXIuoYNLAV4T2ugpS_Z--fbEJUINKvb13AFv9Cqks5MlOuZ6oTtuo58hPvrOg6fhBJedH6_IH6Ta1pEWYGS5LfE8rF_qa-06EBga2JqJNRy3KfQpKf4Lj7ApkcHTsDDO0VzFFeYB3ICy8=s0-d-e1-ft#https://gallery.mailchimp.com/283f05b120a2d42944ac78377/images/5df4bc72-44bc-4f2a-94bb-0e1967374984.png" width="76" style="text-align:center;font-size: 11px;max-width: 76px;padding-bottom: 0;display: inline!important;vertical-align: bottom;border: 0;min-height: auto;outline: none;text-decoration: none;height: auto !important;-ms-interpolation-mode: bicubic;color:#fcbb2a;" class="CToWUd">
     </td>
   </tr>
</table>

Try this way

img {
    text-align: center;
font-size: 11px;
max-width: 76px;
padding-bottom: 0;
display: inline!important;
vertical-align: bottom;
border: 0;
min-height: auto;
outline: none;
text-decoration: none;
height: auto !important;
-ms-interpolation-mode: bicubic;
color: #fcbb2a;
line-height: 71px;
}

you can edit the width and height according to your need.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM