TEACH YOU HOW TO USE CSS TO ACHIEVE WEB PAGE HIDDEN TEXT
Now the increasingly dynamic web page design, if we want to achieve dynamic web page, search engine friendly, and it will have to add a Web page with some text, the text of a clear and present our dynamic web page of the style.?Settlement method is to turn these words are provided.In response to this demand small numbered people amassed several css web page hidden characters, in need of friends may wish to refer to.
1. text – indent: – 9999px
This method has one limitation applied only to the block – level element block, and if we want to hide out on a font, the question becomes, will be converted into a block, then, often behind it, the element is a quick trip to the next line, if this is one of just a behind a button,One way for a float to float so that the re – emergence of supporters behind him, seemingly having a little trouble. Oh!
2. The display: none
This is one of the most well – known and most common method.It can make the container itself, is something that disappears, is simply and effectively.But nobody is perfect, this kind of method has defects of two familiar, is the search engine friendly, and is a screen reader to ignore.
3.: absolute
The principle of this method is the use of absolute positioning will launch the viewable text, but while the visibility is not present, but still occupy physical space, it is not a real hidden text.
The relevant codes are as follows
. { : absolute; margin - top: 9999px -; margin - left: - 9999px; }
4. The overflow: hidden
The relevant codes are as follows
. { display: block; / * it translates the block - level element * / overflow: hidden; width: 0; height: 0; }
5. Use line – height: 0
code
. { line - height: 0; font - size: 0; overflow: hidden; }
Don't look at the code, and there are only 3 rows.But they are not only excellent in the effect is hidden in your background above the font, but also in ie6. 0, 7.0, 8.0, Firefox 3. 010 browsers can use.
6. The visibility: hidden
Sets the visibility of the element is hidden is also a commonly used method, and display: none differs from the text in the page after the disappearance, which occupied the space still remains, so it will only cause the browser to redraw without rearrangement.
{hidden. visibility: hidden; }
Visibility: hidden for concealing characters and then not want a page layout change of the scene.
And that's small make up for everyone to snare a hidden web page text of the six kinds of methods, although they are very simple, yet in different degree, there are some flaws but called no matter if a cat, a good cat catches mice.These methods can help us reach the final destination, the small plait feel is the good method.Of course if you have a better way to welcome to the small series of message exchanges among all of us!