This page provides an overview of inline CSS and basic styling techniques used in HTML emails.
CSS (Cascading Style Sheets) is used to style HTML elements, allowing you to control the appearance of your emails. However, not all email clients support external stylesheets or embedded styles. Thus, inline CSS is the most reliable method for styling HTML emails.
Inline CSS involves adding the style attribute directly to HTML elements. This ensures that styles are applied consistently across different email clients. For example:
<p style="color: #333333; font-size: 16px;">This is a styled paragraph.</p>
Common styling properties for HTML emails include:
color: Sets the text color. Example: color: #000000;font-size: Adjusts the text size. Example: font-size: 14px;font-family: Specifies the font type. Example: font-family: Arial, sans-serif;background-color: Sets an element's background color. Example: background-color: #f0f0f0;padding and margin: Controls spacing inside and outside elements. Example: padding: 10px;<a href="https://example.com" style="display: inline-block; padding: 10px 20px; background-color: #007BFF; color: #ffffff; text-decoration: none;">
Click Me
</a>
This code creates a button with a blue background and white text, styled entirely with inline CSS.