{"id":96687,"date":"2024-05-17T09:11:06","date_gmt":"2024-05-17T07:11:06","guid":{"rendered":"https:\/\/happybrain.it\/?p=96687"},"modified":"2024-05-17T15:28:45","modified_gmt":"2024-05-17T13:28:45","slug":"html-e-css-nelle-e-mail","status":"publish","type":"post","link":"https:\/\/happybrain.it\/en\/2024\/05\/17\/html-e-css-nelle-e-mail\/","title":{"rendered":"HTML and CSS in E-mails"},"content":{"rendered":"<div class=\"wpb-content-wrapper\"><p>[vc_row row_height_percent=&#8221;0&#8243; overlay_alpha=&#8221;50&#8243; gutter_size=&#8221;3&#8243; column_width_percent=&#8221;100&#8243; shift_y=&#8221;0&#8243; z_index=&#8221;0&#8243; uncode_shortcode_id=&#8221;185403&#8243;][vc_column column_width_percent=&#8221;80&#8243; gutter_size=&#8221;3&#8243; overlay_alpha=&#8221;50&#8243; shift_x=&#8221;0&#8243; shift_y=&#8221;0&#8243; shift_y_down=&#8221;0&#8243; z_index=&#8221;0&#8243; medium_width=&#8221;0&#8243; mobile_width=&#8221;0&#8243; width=&#8221;1\/1&#8243; uncode_shortcode_id=&#8221;146320&#8243;][vc_empty_space empty_h=&#8221;1&#8243;][vc_column_text uncode_shortcode_id=&#8221;202920&#8243;]Are you about to make some changes to your e-mails using CSS but you&#8217;re not quite sure how to do it? There are a couple of things you should know before you get down to business, understanding the constraints of email clients and their various degrees of CSS support is indeed a key aspect.<\/p>\n<p>Let&#8217;s take a look at a few tips to make the task easier:<\/p>\n<p><strong>Use inline styles<\/strong>: make sure you use the \u2018style\u2019 tag to incorporate your CSS rules into the HTML code this is because email clients need inline styles and not websites, which often make use of external style sheets.<\/p>\n<p><strong>Keep it simple<\/strong>: it would be preferable to stick to the basic CSS properties as not all of them are supported by e-mail clients. Examples are font colour and size as well as background colour.<\/p>\n<blockquote><p>HappyTips: avoid complicating your work by using shadows, gradients and animations.<\/p><\/blockquote>\n<p>[\/vc_column_text][vc_single_image media=&#8221;96695&#8243; media_width_percent=&#8221;100&#8243; uncode_shortcode_id=&#8221;191299&#8243;][vc_column_text uncode_shortcode_id=&#8221;710229&#8243;]<strong>Use tables for layout<\/strong>: although modern online design mainly relies on CSS for graphical layout, email design continues to make extensive use of tables.<\/p>\n<blockquote><p>HappyTips: favour the use of tables to organise your email layout and forget about flexboxes, floats or grids.<\/p><\/blockquote>\n<p><strong>Check your emails<\/strong>: it is good to make sure that your emails display correctly on all platforms given the variety of email clients and devices that exist. How to do this?<\/p>\n<blockquote><p>HappyTips: Use tools such as Litmus and Email on Acid to check the CSS compatibility of your emails<\/p><\/blockquote>\n<p><strong>Fallbacks<\/strong>: Use fallbacks, having an alternative solution when an email client does not support certain CSS attributes is a lifeboat.<\/p>\n<p>We have compiled a set of guidelines that, if you follow them, will assist you in creating attractive and efficient emails that will be compatible with most email clients. An ever-valid tip is to test your emails regularly to verify and consequently ensure maximum compatibility. That way if problems arise you can take timely action by making CSS changes where necessary.[\/vc_column_text][vc_single_image media=&#8221;96697&#8243; media_width_percent=&#8221;100&#8243; uncode_shortcode_id=&#8221;102338&#8243;][vc_column_text uncode_shortcode_id=&#8221;635797&#8243;]Let&#8217;s delve into a few aspects:[\/vc_column_text][vc_custom_heading heading_semantic=&#8221;h3&#8243; uncode_shortcode_id=&#8221;165610&#8243;]Internal CSS[\/vc_custom_heading][vc_column_text uncode_shortcode_id=&#8221;209900&#8243;]We all agree that one of the most tedious aspects during the email creation process is the need to specify styles directly within the style attributes of each element, in other words we are referring to \u2018inline CSS\u2019.<\/p>\n<p>However, internal CSS, i.e. styles defined within a &lt;style&gt; element, now enjoys greater support. This approach is much more efficient as it allows you to use combinations of selectors and reduce the amount of code, making it more readable.<\/p>\n<p>In order to implement internal CSS correctly, certain rules must be followed. Are you already giving up because you think the rules are too many? And here comes the good news! Fortunately, you can adhere to all these rules simply by using two &lt;head&gt; elements and inserting the &lt;style&gt; element in the second one.[\/vc_column_text][vc_custom_heading heading_semantic=&#8221;h3&#8243; uncode_shortcode_id=&#8221;654302&#8243;]Multimedia queries[\/vc_custom_heading][vc_column_text uncode_shortcode_id=&#8221;198319&#8243;]The internal CSS allows you to employ multimedia queries, which are essential for responsive design. We recommend creating responsive layouts that can be elegantly adapted to simpler, vertical layouts.<\/p>\n<blockquote><p>Happy Tips: Avoid nested media queries. Limit or completely avoid using feature conditions such as screen width, minimum and maximum width.<\/p><\/blockquote>\n<p>[\/vc_column_text][vc_single_image media=&#8221;96694&#8243; media_width_percent=&#8221;100&#8243; uncode_shortcode_id=&#8221;743401&#8243;][vc_custom_heading heading_semantic=&#8221;h3&#8243; uncode_shortcode_id=&#8221;101382&#8243;]Customised fonts[\/vc_custom_heading][vc_column_text uncode_shortcode_id=&#8221;914453&#8243;]Custom fonts improve the aesthetics of e-mails, making them more attractive, however, integration via the most common method () is only supported by 21.21% of current e-mail clients.<\/p>\n<p>The alternative, @font-face, unfortunately does not enjoy much wider support. Despite these limitations, both methods allow the use of fallback fonts, minimising the risks in adopting @font-face.<\/p>\n<p>This approach remains relatively simple and can be used with font services such as Google Fonts and Adobe Fonts.[\/vc_column_text][vc_custom_heading heading_semantic=&#8221;h3&#8243; uncode_shortcode_id=&#8221;634929&#8243;]SVG images[\/vc_custom_heading][vc_column_text uncode_shortcode_id=&#8221;204854&#8243;]Unfortunately, SVG has very limited support and its fallback options are even less reliable. At the moment, it would be preferable to avoid the use of SVG and opt for PNG\/JPG images instead.<br \/>\nIn general, it is advisable to limit the use of heavy images, not only for performance reasons on slower devices, but also to ensure a better user experience on portable devices by avoiding excessive scrolling.<\/p>\n<p>You thought it would be easier, didn&#8217;t you? Well yes, email development remains complex despite the introduction of modern features.<br \/>\nIf you want to lighten the stress load, we recommend using drag and drop from Postcards to create the desired design without having to worry about which HTML\/CSS features are supported or not.[\/vc_column_text][\/vc_column][\/vc_row]<\/p>\n<\/div>","protected":false},"excerpt":{"rendered":"<p>We have drawn up a set of guidelines to help you create attractive and efficient e-mails that work on a wide range of e-mail clients.<\/p>\n","protected":false},"author":13,"featured_media":96693,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[281,406],"tags":[235,439,440,485,489,491,492],"class_list":["post-96687","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-web-design","category-about-web","tag-web-design","tag-html","tag-web","tag-query","tag-font","tag-email","tag-css"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/happybrain.it\/en\/wp-json\/wp\/v2\/posts\/96687","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/happybrain.it\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/happybrain.it\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/happybrain.it\/en\/wp-json\/wp\/v2\/users\/13"}],"replies":[{"embeddable":true,"href":"https:\/\/happybrain.it\/en\/wp-json\/wp\/v2\/comments?post=96687"}],"version-history":[{"count":16,"href":"https:\/\/happybrain.it\/en\/wp-json\/wp\/v2\/posts\/96687\/revisions"}],"predecessor-version":[{"id":96720,"href":"https:\/\/happybrain.it\/en\/wp-json\/wp\/v2\/posts\/96687\/revisions\/96720"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/happybrain.it\/en\/wp-json\/wp\/v2\/media\/96693"}],"wp:attachment":[{"href":"https:\/\/happybrain.it\/en\/wp-json\/wp\/v2\/media?parent=96687"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/happybrain.it\/en\/wp-json\/wp\/v2\/categories?post=96687"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/happybrain.it\/en\/wp-json\/wp\/v2\/tags?post=96687"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}