0

css でクラスを設定して、画像と画像の後に文字列を表示しようとしています。問題は、画像とテキストの重なりです。同じクラス内で画像とテキストの間に間隔を置く方法はありますか? これが私のコードです:

.innerTitle {
display: inline;
background-image: url(../images/tsegs_squigs.jpg);
background-repeat: no-repeat;
background-position: left center;
font-size: 16px;
font-weight: bold;
text-transform: uppercase;
margin: 0px;
padding: 0px;
width: 100%;
}
4

2 に答える 2

1

これを css クラスに追加します。

{text-indent:50px;} Or
{text-indent:<width of background image>px;}
于 2013-06-07T18:08:34.357 に答える
0

パディングは背景が表示される要素のサイズを大きくするため、要素にパディングを追加する必要があります。パディングは、ブロック要素とインライン ブロック要素でのみ機能します。

.innerTitle {
    display: inline-block;
    padding-left: <width of background image>px
}
于 2013-06-07T18:09:21.703 に答える