我正在尝试让几个DIV完全可点击。我试过这个......
<div id="features" class="threeSplit">
<div id="box1">
<a href="javascript:;">
<h3>Watch TV anywhere</h3>
<p>While you're out of town, you can still watch live television.</p>
</a>
</div>
<div id="box2">
<a href="install">
<h3>No subscription</h3>
<p>Save your money. VRT and RTBF channels are available at no cost.</p>
</a>
</div>
<div id="box3">
<a href="coverage">
<h3>Picking up channels</h3>
<p>Television channels can be picked up from antennas near you.</p>
</a>
</div>
</div>
点击此处查看live版本。现在,XHTML 1.0 Strict并不喜欢将块元素放在锚标记中。有没有更好的方法符合XHTML Strict?我知道该页面仍然包含许多验证错误,但这只是一个快速的'n脏模型。
答案 0 :(得分:3)
您可以在div元素中使用onclick
事件...
<div id="box2" onclick='window.location = "install"'>
<h3>No subscription</h3>
<p>Save your money. VRT and RTBF channels are available at no cost.</p>
</div>
答案 1 :(得分:0)
你可以
span
标记放在a
代码中,而不是h3
和p
,并相应地设置样式a
代码我想说,最后一个选项更优雅。