<a> element not allowed to wrap <p>? | Community
Skip to main content
Jamie_Rodger
Level 3
July 24, 2015
Question

<a> element not allowed to wrap <p>?

  • July 24, 2015
  • 5 replies
  • 2698 views

In an email template I have created a button in html and am looking to hyperlink the whole item, not just the text inside. Marketo seems to hate this line of code:

<a href="#" style="text-decoration:none">

           <p style="background-color:#00673E; text-align:center; padding: 10px 10px 10px 10px; margin: 10px 10px 10px 10px;color: #FFFFFF;   font-family: Merienda, 'Times New Roman', serif, sans-serif; ">

                    Student Success

              </p>

</a>

I get this error:

line 582 column 1 - Warning: missing </a> before <p>

line 584 column 1 - Warning: discarding unexpected </a>

Is there a particular reason Marketo refuses to allow the <a> element to wrap the <p>? It works in other clients and in browser, it even shows the hyperlink in the template preview. Marketo keeps stripping it when a sample is sent though.

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.

5 replies

Level 2
July 24, 2015

Thank you for posting this question. I noticed the same <a> tag wrap anomaly yesterday; the system kept stripping the wrap. I'm curious if you get an answer.

July 24, 2015

@Jamie Rodger​ Moving your post to Products and Support​ section of the site.

July 24, 2015

This is actually a legacy left over from previous versions of HTML. It's only with HTML 5 that you're able to wrap a paragraph in an anchor like that, previously it would have been incorrect.

You can read the rules about tag order here: The global structure of an HTML document

The fascinating thing is that the English language has similar unspoken rules. For example, it's always "the big blue box." Saying "the blue big box" sounds weird.

Ravi_Ansal2
Level 5
July 27, 2015

Hi Jamie,

You wont be able to wrap paragraph with HTML.

These are few weird rules of HTML. This happen with <TD>....</TD> as well.

If you want an alternative to hyperlink the whole strip on the LP; i would suggest you to replace the paragraph with the image.

September 10, 2015

You can not wrap anything except text or img tags. Why...Not because of Marketo or Modern HTML but because of that beautiful creature called outlook.

A few of the email clients only render/recognize the link if it is the direct parent element to the text or img. Making it a bad practice for email.

What are you trying to do create a full sized button?