Html 如何使用 CSS 隐藏标题标签?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/13626231/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How can you hide the title tag using CSS?
提问by Fero
<article id="node-13" class="node node-article node-promoted node-teaser contextual-links-region clearfix" about="/fos/node/13" typeof="sioc:Item foaf:Document">
<header>
<h2 class="title" property="dc:title" datatype="">
<a href="/fos/node/13">TITLE GOES HERE.....</a>
</h2>
</header>
</article>
I need to hide the title using CSS.
我需要使用 CSS 隐藏标题。
How can I do that...
我怎样才能做到这一点...
As I am totally new to CSS kindly advice how to do this..
因为我对 CSS 完全陌生,所以请建议如何做到这一点..
UPDATE:
更新:
For the unique article id
对于唯一的文章 ID
if we give title:hidden it will not display for all nodes.
如果我们给出 title:hidden 它将不会为所有节点显示。
In my case it should not display only for specific nodes.
在我的情况下,它不应仅针对特定节点显示。
回答by dsgriffin
Give it display:none;
:
给它display:none;
:
article#node-13 h2.title { display: none; }
Alternativly use visibility:hidden;
替代使用 visibility:hidden;
article#node-13 h2.title { visibility:hidden;}
display:nonemeans that the the tag in question will not appear on the page at all - rhere will be no space allocated for it between the other tags.
display:none意味着有问题的标签根本不会出现在页面上 - 其他标签之间不会为它分配空间。
visibility:hiddenmeans that unlike display:none, the tag is not visible, but space is allocated for it on the page.
可见性:隐藏意味着与display:none不同,标签不可见,但在页面上为其分配了空间。
回答by George
To remove the element from the flow of the page:
从页面流中删除元素:
display:none;
To hide the element but keep it in the flow of the page:
要隐藏元素但将其保留在页面流中:
visibility:hidden;
回答by A.M.K
Try article#node-13 h2.title { display: none; }
, this will only hide the title element if it is inside node 13,
尝试article#node-13 h2.title { display: none; }
,这只会隐藏标题元素,如果它在节点 13 内,
Demo: http://jsfiddle.net/SO_AMK/2QQDd/
演示:http: //jsfiddle.net/SO_AMK/2QQDd/
If you would like to hide the entire article then you could do this: article#node-13 { display: none; }
.
如果你想隐藏的整篇文章,那么你可以这样做:article#node-13 { display: none; }
。
Please note that display: none;
completely removes the element from the page flow, this means that the element will not only be invisible but it will completely collapse.
请注意,display: none;
从页面流中完全删除元素,这意味着该元素不仅不可见,而且会完全折叠。
If you would like to merely hide the element and not "collapse" it then you should use article#node-13 h2.title { visibility: hidden; }
. As you can see in the demo, it still takes up space above the second link,
如果您只想隐藏元素而不是“折叠”它,那么您应该使用article#node-13 h2.title { visibility: hidden; }
. 正如你在演示中看到的,它仍然占用第二个链接上方的空间,