HTMl中是否有可用于分组的逻辑容器标签? [英] Is there any logical container tag in HTMl that I can use for grouping?
问题描述
我需要在页面中看不到的东西,这些东西没有任何边框,并且根本不影响页面渲染。 我希望它的标记边框不会显示在页面上,或者根本不会改变渲染。 例如,我希望呈现的结果与以下内容相同: 和: div很糟糕,因为它有一个边框并在html页面中用新行进行渲染。 p> dsa 也变得不可见了 HTML中没有这样的元素。最接近的是 这个工作原理(并且是有效的HTML)是因为这些元素具有透明内容模型。例如, 使用这种元素是否合乎逻辑是有争议的,但在事实上,根据你在做什么, 在某种程度上, I need something not visible in page, something that don't have any borders and something that doesn't affect page rendering at all.
I need this for a mass hiding or showing things inside, like I want it's tag borders to not be shown on the page or changed the rendering at all. For example, I want the rendered result to be same for: and: The div is bad, because it have a borders and renders from new line in html page. dsa also became invisible My interpretation of the question: You would like to use an HTML element, inside the There is no such element in HTML. What come closest are The reason why this works (and is valid HTML) is that these elements have "transparent content model". E.g., an Whether it is logical to use such elements is debatable, but in fact, Beware that some user agents or assistive software may (at least in future) implement these elements in a manner that reflects their defined meaning. For example, a speech browser might speak "inserted text" and "end of inserted text" before and after an To some extent, the 这篇关于HTMl中是否有可用于分组的逻辑容器标签?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
我需要这个来隐藏或显示内容,比如 document.getElementById(asd)。innerHTML =blah bla blah and some buttons and etc; $ c $
< div>
asd
< input type =buttonvalue =dsa/>
< table>
< tr>
< td> zxc< / td>
< / tr>
< / table>
qwe
< / div>
< DIV>
asd
< something id =asd>
< input type =buttonvalue =dsa/>
< table>
< tr>
< td> zxc< / td>
< / tr>
< / table>
< / something>
qwe
< / div>
< html>
< head>
< title> asd< / title>
< / head>
< body>
asd< div id =test_divstyle =display:none;> dsa< / div>
< / body>
< / html>
ins
和 del
。它们可能已经足够接近了,因为它们对渲染唯一的默认效果是文本内容分别带有下划线或者过分强调(浏览器对块内容中的文本执行此操作时不一致),并且这些效果很容易被抵消,这是通常的CSS警告:
ins,del {text-decoration:none; }
ins
元素可能包含在元素出现的上下文中允许的任何内容。
ins
(对于插入的内容)甚至可能被认为是符合逻辑的。
<请注意,某些用户代理或辅助软件可能(至少将来)以反映其定义含义的方式实施这些元素。例如,语音浏览器可能会在 ins
元素前后说出插入文本和插入文本结束。
a
元素(没有任何属性)在很大程度上可以以相同的方式使用(它也具有浏览器实践中的透明内容模型和HTML5 CR),但它有一些限制,使这种方法可疑。特别是,通过语法规则, a
元素不得包含另一个 a
元素或其他交互式内容 输入
。document.getElementById("asd").innerHTML = "blah bla blah and some buttons and etc";
<div>
asd
<input type = "button" value = "dsa" />
<table>
<tr>
<td>zxc</td>
</tr>
</table>
qwe
</div>
<div>
asd
<something id = "asd">
<input type = "button" value = "dsa" />
<table>
<tr>
<td>zxc</td>
</tr>
</table>
</something>
qwe
</div>
<html>
<head>
<title>asd</title>
</head>
<body>
asd<div id = "test_div" style = "display: none;">dsa</div>
</body>
</html>
body
element, so that it can include various elements, including block elements like tables, so that the page is rendered as if the element’s start and end tag were not there. That is, as if the element were replaced by its content. In particular, it should not cause any line break.ins
and del
. They might come close enough, as their only default effect on rendering is that text content is underlined or overstruck, respectively (browsers implement this inconsistently for text inside block elements), and these effects are easily cancelled out, with the usual CSS caveats:ins, del { text-decoration: none; }
ins
element may contain anything that would be allowed in the context where the element appears.ins
(for inserted content) might even be regarded as logical to use, depending on what you are doing.ins
element.a
element (without any attributes) could be used largely the same way (it, too, has transparent content model in browser practice and in HTML5 CR), but it has some restrictions that make that approach questionable. In particular, by the syntax rules, an a
element must not contain another a
element or other "interactive content" like input
.