在ios6上的一些内嵌浏览器上发现按钮点击事件无效的状况,按钮是这么写的

<a><div>XXXX</div></a>

翻阅了一下资料,发现在XHTML标准中是不推荐这么做的,内联元素内部是不可以放入块级元素的,尽管大部分浏览器是支持的,以后还是不要用这种写法以下是国外一哥们chris.upjohn的对这个问题的看法:

Works very well on mobile but older browsers such as IE have a hell of a time trying to render things right if you don't make the anchor display: block

Block level elements in XHTML are strictly for layouts E.g. containers for headers, content wrappers and such, using a block level element within an inline element is wrong because you are changing the design of what an inline element is supposed to be used for hence you have already written bad markup for doing so. HTML5 gets around this by adding one extra section to the specification that says we can do this but it still goes against the reasoning why an anchor element is inline in the first place, personally I feel that an anchor tag should be used for nothing else but text and span elements for icon purposes since they are both inline but anything like a <div>, <canvas> etc... should be made clickable another way.