Support » Fixing WordPress » wrapping a link tag around a header

  • magician11

    (@magician11)


    So I’m not sure if this code is even technically well formed…

    <a href="www.google.com">
    <h3>a heading</h3>
    <img src=""/>
    </a>

    Because if I write that in the HTML editor, then click on visual, then back to HTML, the <a> tags are stripped out.

    Essentially I want to have a heading and an image underneath it, where both are clickable to some URL.

    Suggestions?

Viewing 2 replies - 1 through 2 (of 2 total)
  • You can’t use a block-level element (such as “<h3>”, “<p>” or “<table>”) inside an inline element (such as “a”, “<span>”, or “<font>”).

    It needs to be plain text. The following code would be fine:

    <a href="www.google.com">
    <strong> a heading </strong> <br />
    <img src=""/>
    </a>

    magician11

    (@magician11)

    Awesome. Works perfectly. thank you.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘wrapping a link tag around a header’ is closed to new replies.