[whatwg] Tag Soup: Blocks-in-inlines

Ian Hickson ian at hixie.ch
Sat Nov 3 02:36:55 PDT 2007


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.   `._.-(,_..'--(,_..'`-.;.'



More information about the whatwg mailing list