2016-02-20 61 views
0

你如何重疊標題部分中的兩個圖像?我想要其中一個圖像作爲背景,另一個要在該圖像的頂部,但是floating left。 你會如何定位?或者更好地使用CSS和如何? 請記住,我是網頁設計的新手。謝謝!如何重疊標題部分中的圖像?

<div style="position:relative; left:0; top:0;"> 
    <h1> 
    <img src="C:\Users\zacfre9292\Desktop\Favorite Music\JSC2.jpg" alt="Jesus Culture logo" width="1900" height="197"> 
    </h1> 

    <h1> 
    <img src="C:\Users\zacfre9292\Desktop\Favorite Music\jesusculture logo.png" alt="Jesus Culture logo" width="700" height="200" > 
    </h1> 
</div> 
+0

使用CSS Z-index屬性並以更大的z索引股利將在頂部,同時重疊。 – Mehar

+0

你使用什麼工具/語言? –

+0

我只是使用記事本++。注意到先進。 –

回答

1

使用一個圖像作爲背景的div,然後讓其他圖像(和標題的內容,如果有的話)在div內。例如:

body { 
 
    width: 100%; 
 
    height: 100%; 
 
    margin: 0px; 
 
} 
 

 
#headerbg { 
 
    width: 100%; 
 
    height: 150px; 
 
    position: relative; 
 
    background: url('http://i.imgur.com/3S4zuof.gif'); 
 
    background-repeat: no-repeat; 
 
    background-size: 100% 100%; 
 
}
<div id="headerbg" alt="image" style="text-align:center;"> 
 
<img src="http://i.imgur.com/Goy7oBy.gif" alt=logo style="max-height:150px"> 
 
</div>