字体大小0仍显示在IE7中 [英] font-size 0 still shows up in IE7
问题描述
出于某种奇怪的原因,当我设置font-size:0px时;在我的样式表中的锚链接中,IE7仍然显示文本的微小版本.我应该考虑采取什么措施完全隐藏文本,而不使用text-indent吗?
For some odd reason, when I set a font-size:0px; in my style-sheet for an anchor link, IE7 still shows a tiny-tiny version of the text. Is there anything I should consider doing to completely hide the text, without using text-indent?
锚点本身在CSS中使用背景图像.而且我只想隐藏HTML页面上的锚链接中的文本.
The anchor itself is using a background image in the css. And I simply want to hide the text that in the anchor link, on the HTML page.
推荐答案
visibility: hidden
和display: none
是隐藏元素的标准.
visibility: hidden
and display: none
are the standards in hiding elements.
两者之间的区别在于visibility
的行为就像不透明,其中元素被隐藏,但仍会影响页面的布局(例如200px高的元素仍会使其下方的元素比其下方的元素低200px不在那里).
The difference between the two is that visibility
acts like opacity, in which the element is hidden but it still affects the layout of the page (e.g. a 200px high element will still make the element below it 200px lower than if it were not there).
display
的行为就像该元素根本不存在-高200像素的元素不会使该元素下方的元素比第一个元素不存在的像素低200像素.
display
acts as if the element were not there at all - a 200px high element would not make an element below it 200px lower that it would be if the first element were not there.
摘要:
因此,如果要隐藏文本并在其位置保留空白,请使用visibility: hidden
.如果要隐藏文本并使其表现为根本不存在,请使用display: none
Summary:
Thus, if you want to hide the text and leave a blank space in its place, use visibility: hidden
. If you want to hide the text and have it act as if it were not there at all, use display: none
这篇关于字体大小0仍显示在IE7中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!