2017-02-07 58 views
2

我在爲OceanGrownFin.com編寫我的網站時遇到了一些問題。如果您滾動瀏覽網站,則遇到問題的三個部分是事件的CSS背景,彈出的視頻以及我的Twitter Feed。在這些文件中,我已經進入了.less文件,並指出了我正在使用的圖片,但出於某種原因,它並未顯示。例如:CSS錯誤編譯

.cbx-event { 
    background: url(/assets/img/shows_bg.png)no-repeat center fixed; 
    -webkit-background-size: cover; 
    -o-background-size: cover; 
    -moz-background-size: cover; 
    background-size: cover; 
    color: #ffffff; 
    .cbx-inner { 
     .bg-rgba(@black-color, 0.8); 
     padding: 11rem 0 11.4rem; 
    } 

    .cbx-heading { 
     h2 { 
      i { 
       color: @white-color; 
       span { 
        background: @white-color; 
       } 
      } 

     } 
    } 

這就是在我的event.less文件中使用的代碼。有人告訴我,我需要編譯這些.less文件,我嘗試使用考拉和WinLESS。在這兩個程序中,當我嘗試編譯時收到此錯誤:

C:\ Users ......... \ themeforest-17690374-musix-music-band-html-template \ ogf \ assets \ less \ event.less NameError:變量@ black-color在C:\ Users \ royal \ Desktop \ OG FIN WEB \ themeforest-17690374-musix-music-band-html-template \ ogf \ assets \ less \ event中未定義。少:14:17

13  .cbx-inner { 
14   .bg-rgba(@black-color, 0.8); 
15   padding: 11rem 0 11.4rem; 

很抱歉,如果這是太多細節,我只是想確保我把所有的信息,我有。我對HTML有一些熟悉,但我不是一個很好的編碼器,所以它可能非常簡單。

回答

1

所以正如錯誤中所述,並在這裏解釋http://lesscss.org/您需要定義變量。

所以,你的風格之前,在文件的頂部,或者在一切之前,變量可以裝入/導入到另一文件中定義的顏色,因爲這:

@black-color: #000000; 
@white-color: #FFFFFF; 

,然後嘗試編譯文件。