1

我想让我的图像成为封面背景,但这对我不起作用。这是我的代码:

<b>
<div id="feedicon" style="display:none; z-index:0;position:fixed;width:32px;height:32px;top:250px;left:0px;">
    <a href="http://www.willmaster.com/index.xml" target="_blank">
        <img src="http://www.willmaster.com/images/feed-icon32x32.png" border="0" width="32" height="32" alt="RSS" title="RSS">
    </a>
</div>
</b>
4

1 回答 1

1

尝试这个:

h1
{
  color:White;
  }
.fullBack
{
  background-image:url('http://www.willmaster.com/images/feed-icon32x32.png');
  background-size:cover;
  width:100%;
  height:100%;
  }
<div class="fullBack">
<h1> some content here </h1>
</div>

使用background-size您可以更改页面中的图像大小以覆盖整个页面。如果您想要封面背景图像,这是一个很好的教程,可以学习如何明智地使用该属性。

编辑- 重要的是要记住这background-size是一个 css3 特征 - 所以谨慎使用它,因为它可能不适用于旧浏览器。

于 2015-08-14T21:51:46.287 回答