Usage
The Divider component is defined incomponents/divider.html.
This enables the <x-divider> syntax, which you can use like this:
emails/example.html
<div>.
Simply using the <x-divider> tag will render a 1px gray horizontal line with 24px of space above and below it.
Customization
You can customize the Divider and give it a custom height (line thickness), change its color, and adjust the space around it.Height
Default:1px
The default height is 1px, but you can change it with the height prop:
emails/example.html
Color
Default:#cbd5e1
Define a custom line color with the color prop. You can use any CSS color value.
If you omit this prop, the Divider will use bg-slate-300 from Tailwind CSS, which is currently set to #cbd5e1.
Let’s change the color to red:
emails/example.html
emails/example.html
Margins
Default:undefined
Add margins to any of the four sides of the Divider, through these props:
toprightbottomleft
32px to the top and 64px to the bottom:
emails/example.html
margin property is used, so you can use any CSS unit that is supported in HTML emails.
Spacing
Default:24px|undefined
You may add top/bottom or left/right spacing through a single prop:
space-yfor top & bottom (default:24px)space-xfor left & right (not set by default)
32px to the top and bottom:
emails/example.html
24px to the left and right:
emails/example.html
Other attributes
You may pass any other HTML attributes to the component, such asdata-* or id.
Note that non-standard attributes will be ignored by default - you’ll need to define them as props in the component if you need them preserved. Alternatively, you can safelist them in your build.components config.
Responsive
To override Divider styling on small viewports, use Tailwind CSS utilities:emails/example.html
Outlook note
The root<div> element of the Divider component needs some extra attention for Outlook on Windows, otherwise it will render thicker than intended.
For the Divider to render the visual line as expected in Outlook on Windows too, it should also be styled with mso-line-height-rule: exactly. In Maizzle, this is set globally in the main.html layout so you don’t need to worry about it.
However, if you can’t use that layout for some reason or are worried that the Outlook-specific CSS in the <head> might be stripped in some situations, simply add it in a style attribute on the tag:
emails/example.html
mso-line-height-rule-exactly class that is available from the tailwindcss-mso plugin (included in the Starter):
emails/example.html
components/divider.html and add the mso-line-height-rule: exactly CSS rule to the <div> element.
Alternatives
There are other ways to create horizontal visual dividers in your HTML emails, such as using a<table> or an <hr>. Check out our Divider examples for more ideas.