Allowed children for an <a> element?

I have been working with a lot of html structuring lately and I started to wonder what are the elements that are allowed as children of an <a> element?

Answers


Changes in HTML5

Although previous versions of HTML restricted the a element to only containing phrasing content (essentially, what was in previous versions referred to as “inline” content), the a element is now transparent; that is, an instance of the a element is now allowed to also contain flow content (essentially, what was in previous versions referred to as “block” content)—if the parent element of that instance of the a element is an element that is allowed to contain flow content.

HTML language reference


Anything as long as there insn't any interactive content like buttons, forms, other link...

w3.org HTML5 specs :

The a element may be wrapped around entire paragraphs, lists, tables, and so forth, even entire sections, so long as there is no interactive content within (e.g. buttons or other links).

see link to source

And here is an example of what you can do (still form w3.org) :

<aside class="advertising">
    <h1>Advertising</h1>
    <a href="http://ad.example.com/?adid=1929&amp;pubid=1422">
        <section>
            <h1>Mellblomatic 9000!</h1>
            <p>Turn all your widgets into mellbloms!</p>
            <p>Only $9.99 plus shipping and handling.</p>
        </section>
    </a>
    <a href="http://ad.example.com/?adid=375&amp;pubid=1422">
        <section>
            <h1>The Mellblom Browser</h1>
            <p>Web browsing at the speed of light.</p>
            <p>No other browser goes faster!</p>
        </section>
    </a>
</aside>

Need Your Help

NamedPipeServerStream C# proper usage - I keep getting IOExceptions

c# .net-3.5 network-programming named-pipes

I've been searching for a while but it seems to be difficult to find any definite answers on how to recover from exceptions thrown by calling NamedPipeServerStream.BeginWaitForConnection. I have an

Responsive DataTables (createdRow)

jquery css jsp servlets datatables

I'm using jQuery DataTables with Responsive extension (responsive: true) and the following source code, it works fine: