npm.io
5.4.0 • Published 1 month ago

mjml-head-attributes

Licence
MIT
Version
5.4.0
Deps
3
Size
5 kB
Vulns
0
Weekly
0
Stars
18.2K

mj-attributes

Inside the mj-attributes tag, you can cite other MJML components, like mj-text for example, to override the default settings for that component.

An mj-all tag is like the above, but affects all MJML components.

An mj-class tag creates a named group of MJML attributes you can apply to MJML components using mj-class="<name>".

<mjml>
 <mj-head>
   <mj-attributes>
     <mj-text padding="0" />
     <mj-class name="blue" color="blue" />
     <mj-class name="big" font-size="20px" />
     <mj-all font-family="Arial" />
   </mj-attributes>
 </mj-head>
 <mj-body>
   <mj-section>
     <mj-column>
       <mj-text mj-class="blue big">
         Hello World!
       </mj-text>
     </mj-column>
   </mj-section>
 </mj-body>
</mjml>

Important

MJML will apply found attributes in the following order:

  • inline attributes within tags,
  • attributes found in tags within the mj-attributes tag, e.g. mj-text,
  • the mj-all tag within mj-attributes, and
  • the default MJML values.

Try it live