哪些元素是“有效的”放在里面< td>标签? [英] Which elements are "valid" to place inside <td> tag?

查看:412
本文介绍了哪些元素是“有效的”放在里面< td>标签?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道在 td 内放置 div 不是一个好主意,但是<$ c $> c> span 和其他元素?哪些元素可以放置在 td 中,哪些不是,为什么? 编辑:问题是我有一个旧的布局,我需要在那里进行修改。为此,我需要在 td 内添加元素,那么插入< td> HTML规范指定了哪些元素可能是其他元素的直接后继者。

< td> 元素有一个流动内容 内容模型,这意味着它可包含:


一个缩写地址区域(如果它是地图元素的后代)文章旁白音频b bdi bdo blockquote br按钮画布引用代码命令datalist del详细信息dfn对话框div dl em嵌入字段集数字页脚表单h1 h2 h3 h4 h5 h6标题hgroup hr i iframe img输入ins kbd keygen标记地图标记数学菜单表导航noscript对象ol输出p前进步s q ruby​​ s samp脚本部分选择小跨度强壮的样式(如果scoped属性存在)sub sup svg table textarea time u ul var video wbr text


I know that it's not a good idea to place div inside td, but what about span and other elements? Which elements are ok to place inside td and which are not and why?

Edit: The problem is that I have an old table layout and I need to make modifications there. To do so, I need to add elements inside td, so what elements will be the least evil to insert into <td>?

解决方案

The HTML spec specifies which elements may be direct decendants of other elements.

The <td> element has a flow content content model, which means it can contain:

a abbr address area (if it is a descendant of a map element) article aside audio b bdi bdo blockquote br button canvas cite code command datalist del details dfn dialog div dl em embed fieldset figure footer form h1 h2 h3 h4 h5 h6 header hgroup hr i iframe img input ins kbd keygen label map mark math menu meter nav noscript object ol output p pre progress q ruby s samp script section select small span strong style (if the scoped attribute is present) sub sup svg table textarea time u ul var video wbr text

这篇关于哪些元素是“有效的”放在里面&lt; td&gt;标签?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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