我有以下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;
}
Run Code Online (Sandbox Code Playgroud)
这个HTML:
<div id="header">
<h1><br><br> Our Services</h1>
</div>
Run Code Online (Sandbox Code Playgroud)
它工作正常,但正如你所看到的,我有一堆 将文本推向右边.否则,它位于图片的顶部.有一个更好的方法吗?
谢谢.
不出所料,要缩进文本,您应该使用text-indentCSS属性.
#header h1 {
text-indent: 1em;
/* ... */
}
Run Code Online (Sandbox Code Playgroud)