这完全适用于
HTML5
<a href="#page1.html">
<div id="container">
<span>Some content</span>
</div>
</a>
display
是
inline
而事实上
div
是
block
.
从
w3.org
这个
a
表格等等,甚至整个部分,只要没有
内部的交互式内容(例如按钮或其他链接)。这个例子
展示了如何将整个广告块制作成
链接:
<aside class="advertising">
<h1>Advertising</h1>
<a href="http://ad.example.com/?adid=1929&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&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>
使用
和
span
显示
<a href="#">
<span>inline element1</span>
</a>
<a href="#">
<span>inline element2</span>
</a>
<a href="#page1.html" class="myClass class2">
<div>block elemnt1</div>
</a>
<a href="#page1.html" class="myClass class2">
<div>block elemnt2</div>
</a>