2015-06-10 28 views
3

现在我试图用语义创建一个包含图片的标题。语义背景图片

这是我的HTML

<div class="ui inverted vertical segment landpage-image"> 
    <div class="ui page grid"> 
     <div class="column"> 
      <h1 class="ui title-header"></h1> 
      <div class="centered grid slogan"> 
       <div class="column"> 
        <p>Some content over here</p> 
       </div> 
      </div> 
     </div> 
    </div> 
</div> 

随着跟随着CSS

.landpage-image{ 
     height: 55%; 
} 

.landpage-image{ 
    background-image: url(/images/landpage.jpg); 
    background-repeat: no-repeat; 
    background-size: cover; 
    background-attachment: fixed; 
} 

但即时得到这个结果。 enter image description here

它看起来很漂亮像素。

回答

1

设置背景覆盖将拉伸图像。如果图像是一个jpeg(或任何其他光栅图像),并且不像您的容器那样宽或高,则它将伸展,从而导致像素化。

+0

这更像是一个评论isnt?顺便说一句,谢谢你的帮助 –

+0

公平你没有真的问我问题。尽管我尽我最大的努力让你知道为什么你的图像是像素化的,以便你可以使用非光栅图像作为你的背景或者使用足够大的图像来避免发生像素化。 –

+0

是啊NP兄弟,顺便说一句我upvote答案= D –