W3C home > Mailing lists > Public > whatwg@whatwg.org > November 2007

[whatwg] Tag Soup: Blocks-in-inlines

From: Ian Hickson <ian@hixie.ch>
Date: Sat, 3 Nov 2007 09:36:55 +0000 (UTC)
Message-ID: <Pine.LNX.4.62.0711030933020.27205@hixie.dreamhostps.com>
On Thu, 26 Jan 2006, Billy Wong wrote:
>
> When somebody want a hyperlink work for one or more block(s) including 
> the inside space and border, it make sense to most to put <a 
> href=""><div>...</div></a> Currently, in order to do the same thing and 
> remain "conformable", people need to do pointless hack like <div 
> onclick=""><a href="">...</a></div> I so wish someone can tell me (and 
> others) a legitimate reason that we should not "put a block-level 
> element inside an inline-level element", besides simply "this is the 
> Rule"

On Thu, 26 Jan 2006, Billy Wong wrote:
>
> But after all the fuss, you still haven't tell anyone why "block" 
> elements *cannot* be in an "inline" element, aside from "this is the 
> Rule"  You asked for an example to show the "need" of it and explain how 
> the look of it can be achieved through other hacks like making the <a> 
> displayed like a <td>, something not quite intuitive to me (and possibly 
> others).  But you haven't show why "inline" have to be "smaller" than 
> "block" (when both are only meaningful in presentation), and what is the 
> potential problem it would introduce when allowed.

I think the short answer is that there isn't really a good reason why we 
can't put blocks inside <a> elements on the long term. On the short term, 
browser parsing differences mean that it is somewhat tricky. For example, 
whether Firefox puts the <p> in the <a> in the following markup:

   <a><p></p></a>

...depends on packet boundaries.

I think we should wait for browsers to uniformly and interoperably 
implement the HTML5 parser spec before starting to change details like 
this. It's definitely something we should look at in future, though.

-- 
Ian Hickson               U+1047E                )\._.,--....,'``.    fL
http://ln.hixie.ch/       U+263A                /,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'
Received on Saturday, 3 November 2007 02:36:55 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Wednesday, 30 January 2013 18:47:42 GMT