是否允许列表内的​​ div? [英] Is div inside list allowed?

查看:23
本文介绍了是否允许列表内的​​ div?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道 LI 中的 DIV 是不允许的,但我最近在许多大"网站上看到了它,比如 Smashing Magazine网页设计师墙...等

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.

我尝试验证站点,但它们有错误,但没有关于 LI 中的 DIV 吗?!

I tried to validate sites, and they have errors, but nothing about DIV in LI?!

那么我可以在 LI 中使用它吗,我需要它是有效的?

So can I use it inside LI, and I need it to be valid?

推荐答案

是的,根据 xhtml1-strict.dtd 是有效的.以下 XHTML 通过了验证:

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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆