4.15.3 • Published 3 months ago

mjml-head-html-attributes v4.15.3

Weekly downloads
82,877
License
MIT
Repository
github
Last release
3 months ago

mj-html-attributes

This tag allows you to add custom attributes on any html tag of the generated html, using css selectors. It's not needed for most email creations, but can be useful in some cases, i.e. editable templates.

<mjml>
 <mj-head>
   <mj-html-attributes>
     <mj-selector path=".custom div">
       <mj-html-attribute name="data-id">42</mj-html-attribute>
     </mj-selector>
   </mj-html-attributes>
 </mj-head>
 <mj-body>
   <mj-section>
     <mj-column>
       <mj-text css-class="custom">
         Hello World!
       </mj-text>
     </mj-column>
   </mj-section>
 </mj-body>
</mjml>

In the generated html, a mj-text becomes a td, and a div inside this td. In this example, the td will have the class="custom". Using the css selector path=".custom div", the div inside the td will get the attribute data-id="42".

To use this component, you will likely have to look at the generated html to see where exactly are the css-class applied, to know which css selector you need to use to add your custom attribute on the right html tag.

You can use multiple mj-selector inside a mj-html-attributes, and multiple mj-html-attribute inside a mj-selector.

4.15.3

3 months ago

5.0.0-alpha.1

3 months ago

5.0.0-alpha.0

3 months ago

4.15.0

3 months ago

4.15.1

3 months ago

4.15.2

3 months ago

4.14.1

1 year ago

4.14.0

1 year ago

4.13.0

2 years ago

4.12.0

2 years ago

4.11.0

2 years ago

4.10.4

3 years ago

4.10.3

3 years ago

4.10.2

3 years ago

4.10.1

3 years ago

4.10.0

3 years ago

4.9.3

3 years ago

4.9.2

3 years ago

4.9.1

3 years ago

4.9.0

3 years ago

4.8.2

3 years ago

4.8.1

3 years ago

4.8.0

3 years ago

4.7.1

4 years ago

4.7.0

4 years ago

4.7.0-beta.2

4 years ago

4.7.0-beta.1

4 years ago

4.7.0-beta.0

4 years ago