css - How to make an image responsive in HTML email regardless of image size -


i creating email template container has max-width: 600px. want able upload images in excess of 800px wide, , images scale down maintain intended aspect ratio. if uploaded 800px wide image, scale 600px.

in outlook, don't think supports max-width images therefore caused stretch.

are there solutions this?

yes , no. outlook tends force image actual size, regardless of css , html sizings. using images bigger want displayed on desktop version break on outlook.

your best bet responsive images have images 100% width inside table has max-width set. around table, make conditional code mso contains set width table @ max-width size.

example below:

<!--[if gte mso 9]> <table width="640"><tr><td> <![endif]--> <table width="100%" style="max-width:640px;"><tr><td><img src="image.jpg" width="100%" /></td</tr></table> <!--[if gte mso 9]> </td></tr></table> <![endif]--> 

there still quirks using max-width not client support it. view css compatability , make little tweaks needed on top of above ensure fits. test test , test more.


Comments

Popular posts from this blog

javascript - AngularJS custom datepicker directive -

javascript - jQuery date picker - Disable dates after the selection from the first date picker -