Coding Tricks
This section will cover some coding tricks which can be used on your emails, email templates, and landing pages.
Center all images on mobile
Display images inline on mobile
Remove underline on links
Remove scrollbars on an iframe
Set default font on a template
Default font trick for Outlook
Prevent images from wrapping on mobile
Using Google Fonts on forms
Using an Accordion Menu on Landing Pages
Center Buttons on Mobile
Change Color in a Numbered List
Apply Gradient Color to an Email Template
Create a Foreign Language version of your email
Center all Images on Mobile
In Template Builder change the mobile code to include the line: margin: 0 auto;
Display Images Inline on Mobile
In Template Builder, add the following code:
{width:auto !important; float: none !important; margin: 0 auto !important; }
.inline-img { display: inline !important; }
Remove the Underline on Links
When adding a link in the Text editor, you can click on the Advanced tab and add some CSS styling to remove the default underline that appears on URLs. In the Style box, under the Advanced tab, add the text: text-decoration: none; NOTE: You can also add this line of CSS to your template to make it the default link behavior. You can further edit the styling by giving the links a different color by also including color: #FFFF00; (using the hex code of the color you wish). To use both, removing the underline and changing the color, add: color: #FFFF00; text-decoration: none;
Remove Scrollbars from an iframe
If you are embedding content and want to remove scrollbars you can add the code scrolling="no" into the iframe.
Set a Default Font on the Template
Using an Accordion Menu on Landing Pages
W3 Schools has a good example of using an accordion menu here, with an example that can be pasted in to the "Paste as Code" Landing Page option. Because the emfluence Drag & Drop editor separates the Page's head and body section, and doesn't allow script tags to be inserted into the body, you will need to make slight changes for this to work on a Drag & Drop landing page.
Into the Head section of you landing page, you will paste both the CSS styles and the script tag with a slight alteration to the code to allow it to work in the head section rather than following the HTML content in the body.
Change the Color in a Numbered List
By default, when using a numbered list those numbers will be displayed in black text. However, if your text is a different color and you want the numbers to match that color, you can add a line of code. NOTE: This workaround may not work in all inboxes. To do so, edit the code of the list and find the opening tag which is <ol>
where we will add a CSS style with the color code for the color you wish to use (ex; <ol style="color:#ffbb21;">
).
Apply Gradient Background on an Email Template
By adding some CSS to the body tag of your template you can apply a gradient background color to your email. NOTE #1: If your template has a background color already in place, it will need to be removed. NOTE #2: This applies only to some Apple devices and will not work on most PC and Android devices.
The code you would add would be (with your choice of colors):
width: 100%;
-webkit-font-smoothing: antialiased;
background: rgb(2,0,36);
background: linear-gradient(90deg, rgba(192,192,192,1) 0%, rgba(255,255,255,1) 35%, rgba(0,0,0,1) 100%);
Create a Foreign Language version of your email
You can make use of Google's translation tools, which allow you to create a foreign language version of any webpage, to create a foreign language version of your email.
To do this you will make use of Google Translate's website conversion tool to get the necessary code for the language you wish to use. Any website can be used here. Set the language settings that you wish to create and let Google translate the page. The code we want is at the end of the URL. For example, for this page https://emfluence-com.translate.goog/?_x_tr_sl=auto&_x_tr_tl=es&_x_tr_hl=en&_x_tr_pto=wapp rendered in Spanish the code we specifically want is
?_x_tr_sl=auto&_x_tr_tl=es&_x_tr_hl=en&_x_tr_pto=wapp
NOTE: The code will be slightly different depending on the language settings you chose.
That code can be added to the end of a specific link in emfluence. To allow a full foreign language version of an email to be rendered on VAWP link, you would use this link https://emailer-emfluence-com.translate.goog/viewaswebpage/$$message[messageID] with the code for the language you want appended at the end. In the example of a Spanish version, the link would look like this: https://emailer-emfluence-com.translate.goog/viewaswebpage/$$message[messageID]?_x_tr_sl=en&_x_tr_tl=es&_x_tr_hl=en&_x_tr_pto=wapp. For traditional Chinese you would use https://emailer-emfluence-com.translate.goog/viewaswebpage/$$message[messageID]?_x_tr_sl=auto&_x_tr_tl=zh-TW&_x_tr_hl=en&_x_tr_pto=wapp. NOTE: Make sure you are using a variable in the email in order for everyone's email to render based on their own content.