簡體   English   中英

我正在處理的Rails應用程序中不會顯示背景圖片

[英]background image wont show up in the rails app i'm working on

我正在嘗試在Rails應用程序中進行一些前端設計工作,但似乎無法在英雄部分中顯示背景圖片! 我認為這可能與他使用的是postgresql有關,而我的系統中沒有。

這是我的css / scss

/*************************HOME PAGE*************************/

body {
    font-family: 'Poiret One', cursive;
}

 .head { 
    border-bottom-style: solid;
    border-color: #fff; 
    border-bottom-width: 1px; 
    padding-bottom: 12px;
    padding-top: 12px;
 }

.headtext {
    font-size: 200%;
    padding-top: 67px;
    font-weight: bold;
}

.hero {
    background: url('heroimage.png');
    background-size: cover;
    background-position: center;
    width: 100%;
    height: 600px;

我已經運行了“捆綁執行耙資產:precompile RAILS_ENV = production”和“耙資產:precompile”命令,以查看是否有幫助,但它似乎仍然沒有出現。 捆綁安裝時安裝“ pg gem”時也存在問題。 該圖像位於app / assets / images目錄中。 抱歉,我的無知! 謝謝!

如果使用提供的SASS輔助方法,Rails / Sprockets將智能地在app/assetsvendor/assetspublic等中查找圖像。

您可以選擇以下選項: image-url("heroimage.png")image-path("heroimage.png")asset-url("heroimage.png")asset-path("heroimage.png")

(如果需要,您也可以使用ERB幫助器-請參閱下面的文檔鏈接。)

這是文檔的鏈接。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM