SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Wizard DoubleDee's Avatar
    Join Date
    Aug 2010
    Location
    Arizona
    Posts
    3,761
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)

    Wrapping Other Tags in <a>

    Is it acceptable HTML to do this...

    PHP Code:
        <a href='" . $articleURL . "'>
            <
    h3>$articleHeading</h3>
            
    $articleImage
        
    </a

    This code is for an Article Summary, and I want both the Heading and Image to be hyperlinked.

    Sincerely,


    Debbie

  2. #2
    Programming Since 1978 silver trophybronze trophy felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, NSW, Australia
    Posts
    16,789
    Mentioned
    25 Post(s)
    Tagged
    1 Thread(s)
    It is in HTML 5 but not in earlier versions of HTML (where the <a> tag was defined as an inline tag and therefore couldn't contain block tags such as h3).To comply with the current HTML standard you'd wrap the elements separately.


    Code:
    <h3><a href='" . $articleURL . "'> $articleHeading</a></h3> 
    <a href='" . $articleURL . "'> $articleImage</a>
    Stephen J Chapman

    javascriptexample.net, Book Reviews, follow me on Twitter
    HTML Help, CSS Help, JavaScript Help, PHP/mySQL Help, blog
    <input name="html5" type="text" required pattern="^$">


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •