简体   繁体   中英

Margin before text in h1

how can I add some space before "Sample Text" using CSS ? For example margin-left:20px; but it does not work properly. Background should stay where it is. I do not want use   in HTML! There is my fiddle: http://jsfiddle.net/gSVfV/293/

HTML

<h1 class="post-title entry-title">Some Text</h1>

CSS

h1.post-title.entry-title {
background-image: url('http://www.forkingandcountry.com/sites/g/files/g2000004371/f/styles/news_landing_image/public/sample_03.jpg?itok=rk7nkdNu');
color: white;
background-repeat: no-repeat;
}

You can use the padding-left property to add some padding on the left. See this updated JSFiddle .

Read more about padding at Mozilla Developer Network .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM