我有以下 CSS 类:
#header h1 {
float:left;
font-family: "Palatino Linotype", "Book Antiqua", Palatino, serif;
font-size: 2.5em;
margin-top: 8px;
margin-left: 0.8em;
padding-left: 40px;
background: url("h1bkgrnd.png") no-repeat left center;
height: 100px;
}
还有这个 html:
<div id="header">
<h1><br><br> Our Services</h1>
</div>
它工作正常,但如您所见,我有一堆
将文本推到右边。否则,它位于图片的顶部。
有一个更好的方法吗?
谢谢。
最佳答案
不出所料,要缩进文本,您应该使用 text-indent
CSS 属性。
#header h1 {
text-indent: 1em;
/* ... */
}
关于css 新手正在寻找更优雅的 css 解决方案来缩进文本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16700076/