Back to Mjml

README

packages/mjml-text/README.md

5.1.04.1 KB
Original Source

mj-text

Displays text which can be styled.

xml
<mjml>
 <mj-body>
   <mj-section>
     <mj-column>
       <mj-text font-family="Helvetica" color="#F45E43">
         <h1>Title</h1>
         <p>Paragraph</p>
         <p style="font-family:Comic Sans Ms">Another paragraph</p>
       </mj-text>
     </mj-column>
   </mj-section>
 </mj-body>
</mjml>
<div class="alert alert-note" role="alert"> <p>Note</p> <p><code>mj-text</code> is an "ending tag", which means that it can contain HTML code but it cannot contain other MJML components.</p> <p>More information about ending tags <a href="#ending-tags">in this section</a>.</p> </div>

Attributes

attributeacceptsdescriptiondefault value
alignleft right center justifytext-alignmentleft
colorCSS color formatstext color#000000
container-background-colorCSS color formatsinner element background color
css-classstringclass name, added to the root HTML element created
font-familystringfontUbuntu, Helvetica, Arial, sans-serif
font-sizepxtext size13px
font-stylestringCSS values, e.g. normal italic oblique
font-weightstringtext thickness
heightpxheight of the element
letter-spacingpx emletter spacing
line-heightpx %space between the lines1
paddingpx %text padding, supports up to 4 parameters10px 25px
padding-bottompx %bottom offset
padding-leftpx %left offset
padding-rightpx %right offset
padding-toppx %top offset
text-decorationstringCSS values, e.g. underline overline none
text-transformstringCSS values, i.e. capitalize uppercase lowercase none
<p class="cta-container"><a class="cta" href="https://mjml.io/try-it-live/components/text">Try it live</a></p>