如何放置文本标题

时间:2014-06-17 15:00:18

标签: html css3

如何在标题图片中放置标题(h1)?像这样 或者我如何将“Hello World”放在图像标题内:D

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

1 个答案:

答案 0 :(得分: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