Mjml: What is the tag for image link?

Created on 26 Apr 2017  路  4Comments  路  Source: mjmlio/mjml

I've trying to use an image as a link and figuring out the solution but can't find one.
The below is the code I've done.

鈻燭his doesn't works.

<mj-inline-links>
    <mj-link href="http://blah">
       <mj-column>
           <mj-image src="banner1_pc.png">
           <mj-image>
       </mj-column>
    </mj-link>
</mj-inline-links>

Text works but not the image.
鈻燭his works.

<mj-inline-links>
    <mj-link href="http://blah">blah
    </mj-link>
</mj-inline-links>

Most helpful comment

you can just set href on mj-image

All 4 comments

you can just set href on mj-image

Hmm..didn't work.
Just did a workaround.
Thanks though!

<mj-inline-links>
    <mj-link href="http://blah">
              <img src="sample.png"  />
    </mj-link>
</mj-inline-links>

hey @iwanaga-sakura, this is not a correct workaroud. As @rogierslag pointed out, you can use the href attribute on mj-image. Live demo: https://mjml.io/try-it-live/S1Nt1RTCl

<mj-image width="100" src="/assets/img/logo-small.png" href="https://mjml.io" />

mj-inline-links and mj-link are meant to be used inside mj-navbar.

Oh wow, it worked!

mj-inline-links and mj-link are meant to be used inside mj-navbar.

This is why, it wasn't working on mine earlier.

@ngarnier @rogierslag Thanks a lot guys!!

Was this page helpful?
0 / 5 - 0 ratings