2014-06-17 66 views
-8

我怎麼可以在標題圖像裏面放一個標題(h1)?這樣 或者我怎樣才能把這個 「Hello World」 的形象水箱內:d如何把文本標題

https://fbcdn-sphotos-d-a.akamaihd.net/hphotos-ak-xpf1/t1.0-9/10489763_237437073119972_1157564384151378847_n.jpg

+0

此線程有你想要的答案![鏈接](http://stackoverflow.com/questions/11339006/writing-text-on-an-image-with-html) – jcjunction

+0

將圖像設置爲背景圖像在包含H1的div或header元素上。 –

+0

我這樣做,但我得到的圖像變得放大 h1 { background-image:url(「2.jpg」); background-repeat:no-repeat; } – Max

回答

1

HTML:

<h1>{ Hello World }</h1> 

CSS

h1 { 
    display:inline-block; 
    width:400px; 
    height:150px; 
    text-align:center; 
    background:url("http://placehold.it/400x200") 0 0 no-repeat; 
    padding-top:50px; 
    margin:0; 
} 

JSFiddle