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

Jamie_Rodger
Level 3

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

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.

5 REPLIES 5
My_Davidson
Level 2

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

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.

Anonymous
Not applicable

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

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

Anonymous
Not applicable

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

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 6

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

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.

Anonymous
Not applicable

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

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?