2014-03-25 153 views
0

比方說,我有一個名爲「作者」 CSS類像這樣的代碼:背景圖像左對齊

.author { 
    background:url('img/user91.png'); 
    background-size:10px 10px; 
    background-repeat:no-repeat; 
    color:#62c6ff; 
    bottom: 0; 
    font-family: sans-serif; 
    text-decoration: none; 
    text-transform: lowercase; 
    font-size: 9px; 
    margin-left: 20px; 
    margin-top: 70px; 
} 

和HTML:

<p class="author"><a href="#">@jimmy</a></p> 

我想@jimmy顯示在AP和在@jimmy的左側出現圖像背景。
this is an example picture

回答

0

你需要添加

background-position: 0 0; padding-left: 10px /*this should be equal to image width*/ 

到.author類

希望這有助於!

你需要任何小提琴鏈接來顯示這個嗎?

1

你應該使用background-position將圖像放在左側:

背景位置:左中心;

背景位置:0 0;

然後用填充發揮地方的鏈接作者:

填充左:15px的;

0

簡單地使用這個

`background:url("img/user91.png") no-repeat right 0px; `