2016-02-19 32 views
0

HTML這個發真棒圖標....試圖取代與IMG

<!-- Services --> 
<section id="services" class="row color" data-scroll-factor="0.7"> 
    <div class="col-md-10 col-md-offset-1"> 
    <div class="icon"><i class="fa fa-desktop"></i></div> 
    <h1>Services</h1> 
    <div class="section-content"> 
     <p>Vibe Music Therapy provides music therapy interventions to a wide range of healthcare settings.<br>There are also a range or corporate CPD based training events that Vibe also get involved with.<br>Click on one of the relevent icons below to find about how we provide music therapy to the people we work with.</p> 
     <div class="row"> 
     <div class="col-md-4 service"> 
      <div class="icon service-icon animate-zoom"><i class="fa fa-vibe"></i></div> 
      <h3></h3> 
      <p></p> 
     </div> 
     <div class="col-md-4 service"> 
      <div class="icon service-icon animate-zoom"><i class="fa fa-briefcase"></i></div> 
      <h3></h3> 
      <p><br></p> 
     </div> 
     <div class="col-md-4 service"> 
      <div class="icon service-icon animate-zoom"><i class="fa fa-users"></i></div> 
      <h3></h3> 
      <p></p> 
     </div> 
     </div> 
    </div> 
    </div><!-- End of .col-md-10 --> 
</section><!-- End of Services --> 

...併爲部分的CSS ...

// Section: Services 
&#services { 
    .service { 
     h3 { 
      font-weight: @titleTextFontWeight; 
      text-transform: uppercase; 
      letter-spacing: 1px; 
      font-size: 18px; 
     } 

     p { 
      font-size: 14px; 
     } 
    } 

    i.fa-vibe { 
     content:url(\http://your-website/link-to-image.png); 
    } 
} 

所以你可以看到我我試圖用一個名爲fa-vibe的img替換一個fa真棒圖標。它似乎沒有工作,雖然只是沒有顯示任何東西,請別人幫忙。

+0

這不是CSS代碼。我認爲這很少,但我不完全確定。 –

+0

正確,我的不好 – havingagoatit

回答

4

它設置爲背景圖片:

i.fa-vibe { 
    content:""; 
    background-image:url('http://your-website/link-to-image.png'); 

    width: 100px; //WIDTH of the icon 
    height: 100px; //HEIGHT of the icon 
    display: inline-block; 
    background-position:center; 
    background-size:cover; 
} 
+0

它有它,但它剪輯大部分似乎並沒有正確居中,如果我改變像素的寬度和高度它消失,但? – havingagoatit

+0

我編輯了答案。這應該使圖像居中,並使其適合i元素,而不管它們的高度是多少。 – rblarsen

+0

是這樣做的,它沒有像其他字體真棒圖標放大位置,但我想這可能是另一回事 – havingagoatit