WordPress.org

Ready to get started?Download WordPress

Forums

wrapping a link tag around a header (3 posts)

  1. magician11
    Member
    Posted 2 years ago #

    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?

  2. Harrison O.
    Member
    Posted 2 years ago #

    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>
  3. magician11
    Member
    Posted 2 years ago #

    Awesome. Works perfectly. thank you.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.