Skip to content
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
50 lines (43 sloc) 1.87 KB


This tag allows you to set CSS styles that will be applied to the HTML in your MJML document as well as the HTML outputted. The CSS styles will be added to the head of the rendered HTML by default, but can also be inlined by using the inline="inline" attribute.

Here is an example showing the use in combination with the css-class attribute, which is supported by all body components.

      <mj-class name="mjclass" color="green" font-size="30px" />
    <mj-style inline="inline">
      .blue-text div {
        color: blue !important;
      .red-text div {
        color: red !important;
        text-decoration: underline !important;
        <mj-text css-class="red-text">I'm red and underlined</mj-text>
        <mj-text css-class="blue-text">I'm blue because of inline</mj-text>
        <mj-text mj-class="mjclass">I'm green</mj-text>

try it live

attribute unit description default value
inline string set to "inline" to inline styles n/a
Mjml generates multiple html elements from a single mjml element. For optimal flexibility, the `css-class` will be applied to the most outer html element, so if you want to target a specific sub-element with a css selector, you may need to look at the generated html to see which exact selector you need.
You can’t perform that action at this time.