2016-06-15 56 views
0

我要顯示在背景的圖像,但它並不顯示:超大屏幕的背景圖像不顯示

<div class="jumbotron jumbotron-fluid background: url('/assets/img/mhacks.jpg') no-repeat center center;"> 
    <div class="container text-sm-center p-t-3"> 

     <h1 class="display-2">Mona Jalal</h1> 
     <p class="lead">Under construction</p> 
    </div> 
</div> 

我看到的是: enter image description here

PS:一般情況下怎麼能我調試這樣的錯誤? 這裏是我的jsfiddle: https://jsfiddle.net/e5qsnjdo/

用下面的代碼:

<div class="jumbotron jumbotron-fluid style="background-image: url('/assets/img/mhacks.jpg') no-repeat center center;"> 
    <div class="container text-sm-center p-t-3"> 

     <h1 class="display-2">Mona Jalal</h1> 
     <p class="lead">Under construction</p> 
    </div> 
</div> 

我得到這些錯誤: enter image description here enter image description here

回答

1

移動你background財產style屬性:

<div class="jumbotron jumbotron-fluid" style="background: url('/assets/img/mhacks.jpg') no-repeat center center;"> 

或者在CSS定義如下:

.jumbotron { 
    background: url('./assets/img/mhacks.jpg') no-repeat center center; 
} 

//注意。之前/資產如果你不使用。它會給404錯誤 -

+0

我得到的錯誤,命名空間的背景未綁定。這是爲什麼? –

+1

@Mona你可以爲你的問題做一個小提琴,因爲你描述的錯誤有點奇怪嗎? –

+0

https://jsfiddle.net/e5qsnjdo/ –

1

<div class="jumbotron jumbotron-fluid" style=" background: url('/assets/img/mhacks.jpg') no-repeat center center;"> 
 
    <div class="container text-sm-center p-t-3"> 
 

 
     <h1 class="display-2">Mona Jalal</h1> 
 
     <p class="lead">Under construction</p> 
 
    </div> 
 
</div>