Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mj-text links css #662

Closed
Fanetteg opened this issue May 4, 2017 · 5 comments
Closed

mj-text links css #662

Fanetteg opened this issue May 4, 2017 · 5 comments

Comments

@Fanetteg
Copy link

Fanetteg commented May 4, 2017

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

@ngarnier
Copy link
Member

ngarnier commented May 4, 2017

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!

@ngarnier ngarnier closed this as completed May 4, 2017
@SoyDiego
Copy link

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!

@Maxime-p
Copy link

Maxime-p commented Jul 6, 2023

Still no fully working answer?

@dmitrypanteleeff
Copy link

Still no fully working answer?

Hi. In my opinion, you can put special atribute style for changing color

 <a href="https://www.google.com" 
     style="color: #FF0000; text-decoration: none;" 
     target="_blank" 
     rel="nofollow">
       <span>google</span>
</a>

@thijs-qv
Copy link

this works for me (color of mj-text block is needed so the anchor color inside differs)

<mjml>
  <mj-head>
  </mj-head>
  <mj-body>
    <mj-section>
      <mj-column>
        <mj-text color="#eeeeee"><a href="https://mjml.io" style="color:#F45e46;text-decoration:none;font-size:20px;font-family:helvetica">red link no underline (as inline style)</a></mj-text>
      </mj-column>
    </mj-section>
  </mj-body>
</mjml>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants