【发布时间】:2012-08-13 19:18:59
【问题描述】:
我知道 div 标签是大多数标签的容器,例如 href 标签……也就是说,我有一个可以工作的文档,并且只有当 a href 标签围绕两个 div 标签时才起作用。
如果我调整 div 和 href 使其符合 w3c,它会扭曲网站。我可能会调整我的 .js 和 .css 以使其工作,但我想找到一个替代解决方案。我可以将 a href 标记保留在现在的位置吗?
感谢您的任何帮助或建议。
链接在这里:http://momentum.freeiz.com/
代码在这里:
<a href="hapo.htm" >
<div class="boxgrid_slideright">
<div id="slideshow">
<img class= "cover" src="images/home/ hapo/0.jpg" width="161" height="107" alt="hapo credit union"/>
<img class= "cover" src="images/home/ hapo/1.jpg" width="161" height="107" alt="hapo credit union"/>
<img class= "cover" src="images/home/ hapo/2.jpg" width="161" height="107" alt="hapo credit union"/>
<img class= "cover" src="images/home/ hapo/3.jpg" width="161" height="107" alt="hapo credit union"/>
<img class= "cover" src="images/home/ hapo/4.jpg" width="161" height="107" alt="hapo credit union"/>
</div><!--slideshow-->
</div><!--boxgrid-->
</a>
【问题讨论】:
-
我猜我的代码没有显示出来,这里是链接:momentum.freeiz.com
-
你真的不应该将块元素放在
<a>元素中,因为某些浏览器(Safari)的行为可能会很奇怪。相反,您可以放置任意数量的内联类型元素(span 等),并使用 css 进行块化:display: block; float: left/right; etc -
如果您将
div元素更改为span元素,那么您将嵌套内联元素,这是允许的。 -
很好,感谢您的快速回复:)
标签: javascript html css xhtml tags