2014-03-25 155 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; `