|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><title>DIVCSS实例:text-indent隐藏文字(以图换字) - mb5u.com</title><style type="text/css">h4 a{display:block; background:url(http://www.w3cbbs.com/images/w3cbbs/logow3cbbs.png) left top no-repeat;width:300px;height:75px;text-indent:300px; white-space:nowrap; overflow:hidden;}</style></head><body><h4><a href="http://www.w3cbbs.com/">css网页布局w3c标准</a></h4></body></html> 以图换字是CSS布局中非常常用的一种手段,因为图片文字有时候比可选的文字的表达效果更好!
因此,某些文字标题是用图片来表达的。但写一个img标签实在不雅,为了照顾蜘蛛,我们使用浏览器障眼法。
于是用最常用的text-indent:
css:
<div class="UBBPanel"><div class="UBBTitle">Example Source Code [www.mb5u.com] |
|