是否允许div内部列表? [英] Is div inside list allowed?
本文介绍了是否允许div内部列表?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我知道LI内部的DIV是不允许的,但我最近在许多大网站上看到它:Smashing Magazine,Web Designer Wall等。
我尝试验证网站,他们有错误,但没有关于在李的div's!!
那么我可以在LI内使用它,并且我需要它是有效的?
解决方案
是的,根据 xhtml1-strict.dtd
有效。以下XHTML通过验证:
<?xml version =1.0?>
<!DOCTYPE html PUBLIC - // W3C // DTD XHTML 1.0 Strict // EN
http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict。 DTD>
< html xmlns =http://www.w3.org/1999/xhtmlxml:lang =enlang =en>
< head>
< meta http-equiv =Content-Typecontent =text / html; charset = utf-8/>
< title>测试< /标题>
< / head>
< body>
< ul>
< li>< div>测试< / div>< / li>
< / ul>
< / body>
< / html>
I know that DIV inside LI isn't allowed, but I've seen it lately on many "big" websites like: Smashing Magazine, Web Designer Wall... etc. I try to validate sites, and they have errors, but nothing about div's in LI?!
So can i use it inside LI, and I need it to be valid?
解决方案
Yes it is valid according to xhtml1-strict.dtd
. The following XHTML passes the validation:
<?xml version="1.0"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Test</title>
</head>
<body>
<ul>
<li><div>test</div></li>
</ul>
</body>
</html>
这篇关于是否允许div内部列表?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文