Hi,
I can't seem to find how the links displayed in mj-text can be styled in mjml.
They stay purple+underline no matter what I do.
Tried to find the solution in the documention and here but couldn't.
Thank you
Hey @Fanetteg, mj-text takes raw HTML so you can style the a element with inlined HTML attributes or even CSS using mj-style.
Example: https://mjml.io/try-it-live/S1D6pL_yb (note that I could have used a instead of the .link-nostyle class)
<mjml>
<mj-head>
<mj-style inline="inline">
.link-nostyle { color: inherit; text-decoration: none }
</mj-style>
</mj-head>
<mj-body>
<mj-container>
<mj-section>
<mj-column>
<mj-text font-size="20px" color="#F45e46" font-family="helvetica">
<a href="https://mjml.io" class="link-nostyle">Hello World</a>
</mj-text>
</mj-column>
</mj-section>
</mj-container>
</mj-body>
</mjml>
I think it solves your issue so I'm closing but feel free to answer and we'll reopen if it's not the case!
Hi, this not working in Outlook or IOs. Someone knows how is the correct code in MJML to blue links in Outlook and IOs. Thanks!
Most helpful comment
Hey @Fanetteg,
mj-texttakes raw HTML so you can style theaelement with inlined HTML attributes or even CSS usingmj-style.Example: https://mjml.io/try-it-live/S1D6pL_yb (note that I could have used
ainstead of the.link-nostyleclass)I think it solves your issue so I'm closing but feel free to answer and we'll reopen if it's not the case!