簡體   English   中英

h1中的文字前的邊距

[英]Margin before text in h1

如何使用CSS在“示例文本”之前添加一些空間 例如margin-left:20px; 但它不能正常工作。 背景應該留在原處。 我不想使用  在HTML中! 有我的小提琴: 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;
}

您可以使用padding-left屬性在左側添加一些填充 請參閱此更新的JSFiddle

Mozilla Developer Network上了解有關填充的更多信息。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM