if statement - Outlook conditional comments hiding mobile version on all clients -
i having trouble responsive email template. when add if !mso statement, prevent mobile version displaying under desktop version in outlook, hides mobile version on mobile email clients. how hide mobile version in outlook still have appear in mobile clients?
css:
@media screen , (max-width: 320px), screen , (max-device-width: 540px) {body { -webkit-text-size-adjust: none;} div[id=desktop] { display:none !important; width:0px !important; overflow:hidden !important; } <!--[if !mso]><!--> div[id=mobile] { display:block !important; width:100% !important; height:auto !important; max-height:inherit !important; overflow:visible !important; } <!--<![endif]--> html:
<!--mobile version --> <!--[if !mso]><!-- --> <div style="width: 0px; display: none; max-height: 0px; overflow: hidden" id="mobile"> <table width="320" cellspacing="0" cellpadding="0" border="0" id="body"> <tr><td>mobile content</td></tr> </table> </div> <!--<![endif]--> <!--end mobile verson-->
instead of conditional comments, set display:none default:
div[id='desktop'], div[id='mobile'] { display: none; } then override clients support media queries:
/* desktop */ @media screen { div[id='desktop'] { display: block; } div[id='mobile'] { display: none; } } /* mobile */ @media screen , (max-width: 320px) { div[id='desktop'] { display: none; } div[id='mobile'] { display: block; } } /* mobile */ @media screen , (max-device-width: 540px) { div[id="desktop"] { display: none; } div[id="mobile"] { display: block; } } references
Comments
Post a Comment