Useful tips for HTML email coding
Before starting to code HTML emails, there are some tips that you could use in order to streamline your work and achieve the results that you want.
- Set your margins to the lowest possible level. For instance you should not set them at the Table level but rather at TD levels. If this doesn't work, you should opt for the anti-paragraph level or even image level
- Keep in mind that floats don't work with most email software and padding doesn't work with some email software
- When you design your HTML table layout, you must use as few HTML tables as possible and you must use the same style for all your images tags: “border:none;display:block”
- When you find something broken that is related to your CSS, the bets thing you should do is to check your colons, semi-colons and double quotes in style declarations
- If the layout is broken, you must always use border=1 in the TABLE tags as you built your email layout.
- Although it might sound a little bit crazy, you should always alphabetize your CSS definitions. For instance colors should be defined before font and so on. This will help you a lot if you want to go into a particular part of your HTML email to find and correct a certain CSS style.
- When you define your inline CSS, you cannot use a shorthand. This is why you should get familiar with the most common CSS styles that you should use. For instance, the font could be split into font-family, font-size, font-weight and the standards should be easily adjusted every time you need to integrate them into your code.