
6.改进的Phark方法
- <style>
- #header {
- text-indent: -5000px;
- background: url(/attachments/month_0803/sample-opaque.gif);
- height: 25px;
- }
- </style>
- <h3 id="header">
- Revised Image Replacement
- </h3>
改进的Phark方法在一定程度上有了完善,不足仍然是在“图像关闭/CSS开启”情况下无效。
7.Dwyer方法
- <style>
- #header {
- width: 329px;
- height: 25px;
- background-image: url(attachments/month_0803/sample-opaque.gif);
- }
- #header span {
- display: block;
- width: 0;
- height: 0;
- overflow: hidden;
- }
- </style>
- <h3 id="header">
- <span>Revised Image Replacement</span>
- </h3>
Dwyer的方法是基于Classic FIR的改进,似乎能在所有的平台中正常运作,包括屏幕阅读器;
不足:“图像关闭/CSS开启”的情况下无效,而且需要一个额外的span。
8.Gilder/Levin方法
- <style>
- #header {
- width: 329px;
- height: 25px;
- position: relative;
- }
- #header span {
- background: url(attachments/month_0803/sample-opaque.gif) no-repeat;
- position: absolute;
- width: 100%;
- height: 100%;
- }
- </style>
- <h3 id="header">
- <span></span>Revised Image Replacement
- </h3>
Gilder/Levin提出的方法理论上解决了平台可访问性问题,而且即使在“图像关闭/CSS开启”的情况下也能让文本显示出来。
不足:需要一组额外的无内容span标签,而且背景图片的透明区域无法隐藏文本,大家可以运行下列代码观察:
- <style>
- #header {
- width: 329px;
- height: 25px;
- position: relative;
- }
- #header span {
- background: url(attachments/month_0803/sample-opaquet.gif) no-repeat;
- position: absolute;
- width: 100%;
- height: 100%;
- }
- </style>
- <h3 id="header">
- <span></span>Revised Image Replacement
- </h3>
9.推荐的带悬停提示方法
不管你使用的是上列何种方法,都放弃了直观的鼠标悬停提示效果。事实上我们并不一定要依赖于alt,这个缺陷我们可以利用title属性来进行完善:
- <style>
- #header {
- width: 329px;
- height: 25px;
- position: relative;
- }
- #header span {
- background: url(attachments/month_0803/sample-opaque.gif) no-repeat;
- position: absolute;
- width: 100%;
- height: 100%;
- }
- </style>
- <h3 id="header" title="汇聚博客资源,点亮博客价值 - 西米CC(http://ximicc.com)">
- <span></span>Revised Image Replacement
- </h3>



