代码之家  ›  专栏  ›  技术社区  ›  Jitendra Vyas

Is it possible to get make left padding like this, without changing HTML?

  •  0
  • Jitendra Vyas  · 技术社区  · 15 年前

    alt text http://shup.com/Shup/372594/110528103234-My-Desktop.png

    How to achieve this with this code.

    <a href="#">Click to Donate to save rabits</a>
    
    a {background:url(rabit.gif); padding-left:70px}
    

    I'm getting like this.

    alt text http://shup.com/Shup/372599/110528103631-My-Desktop.png

    I know it's possible if with change in HTML , but is it possible to achieve this with this code.

    2 回复  |  直到 15 年前
        1
  •  2
  •   Kali Charan Rajput    15 年前

    试试这个

    a {
        background:url(rabit.gif) no-repeat; 
        padding-left:70px; 
        width:50px; 
        font:bold 20px Arial, Helvetica, sans-serif; 
        float:left;
        height:194px;
    }
    

    HTML

    <a href="#">Click to Donate to save rabits</a>
    
        2
  •  0
  •   Dan Iveson    15 年前

    怎么样:

    <a href="#"><img src="rabit.gif" />Click to Donate to save Rabits</a>
    

    然后:

    img {float: left}