【发布时间】:2012-06-08 08:30:05
【问题描述】:
我希望在标题中添加一个 h1 元素,但是我在标题中使用标签(不是背景图像),当屏幕分辨率发生变化时它们会相互替换。
我看过技术
<h1 class="technique-four">
<a href="#">
<img src="images/header-image.jpg" alt="CSS-Tricks" />
</a>
</h1>
h1.technique-four {
width: 350px; height: 75px;
background: url("images/header-image.jpg");
text-indent: -9999px;
}
...但是由于我的布局是流畅的,所以当图像发生变化时可以看到背景。
甚至有必要用图像替换 h1 吗?我就不能这样做:
<h1 class="headerhone">kb-k bwf-kb</h1>
<a href="#"><img src="<?php bloginfo('stylesheet_directory'); ?>/images/720.jpg" class="show-on-phones"/></a>
<a href="#"><img src="<?php bloginfo('stylesheet_directory'); ?>/images/980_full.jpg" class="hide-on-phones"alt=""/></a>
(忽略php)
然后给 h1 的高度为零:
h1.headerhone{
height:0px;
text-indent: 100%;
white-space: nowrap;
overflow: hidden;
} /*this was suggested to me as an alternative to the -9999px; thing.*/
这行得通吗?是否会对 SEO 产生负面影响或可用性问题?
【问题讨论】:
标签: css image header seo replace