font-size 0 still shows up in IE7

扶醉桌前 提交于 2019-12-13 04:58:42

问题


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?

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.


回答1:


visibility: hidden and display: none are the standards in hiding elements.

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 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.

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




回答2:


I would recommend you to create a separate class for the text and set

visibility:hidden;

for that class.



来源:https://stackoverflow.com/questions/16069869/font-size-0-still-shows-up-in-ie7

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!