關於來自this筆的示例6,我需要使用assets/images中存儲的圖像,而不是像例6中那樣通過href鏈接獲取的圖像。它看起來像代碼更改在CSS和HTML中都需要它,但作爲Rails的新手,我還沒有弄清楚他們必須是什麼。在Bootstrap中使用資產/圖像中的圖像
首先,有這個HTML:
<a class="navbar-brand text-hide" href="http://disputebills.com">Brand Text
</a>
位置,在這裏:
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar6">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand text-hide" href="http://disputebills.com">Brand Text
</a>
</div>
再有就是一個CSS代碼,在這裏:
.example6 .navbar-brand{
.example6 .navbar-brand{
background: url(https://res.cloudinary.com/candidbusiness/image/upload/v1455406304/dispute-bills-chicago.png) center/contain no-repeat;
width: 200px;
}
我試圖改變CSS到
background: <%= image_tag("myPETS_logo_36_48.png", class: "navbar-brand", id: "navbar-logo") %> center/contain no-repeat;
width: 200px;
,但即使這部分是正確的,它並沒有修正當前的HTML代碼工作,
<a class="navbar-brand text-hide" href="http://disputebills.com">Brand Text
那麼什麼是傢伙做的就是從資產/圖像,而不是通過一個HREF鏈接ANE圖像?