2013-10-14 41 views
0

是否可以在html中添加背景圖片?你可以在html中添加背景圖片嗎?

這裏是我的小提琴,我需要它的「容器格」

我還需要背景在畫布我能做到這一點在CSS伸展?

http://jsfiddle.net/7Gacp/3/

<div id="profile-container"> 
    <div id="fixed-header"></div> 
    <div class="container" style="background: url("../../img/followers/followers-tabs.png") no-repeat 0 0px;"></div> 
    <div class="sticky-header">This needs to be fixed when hits top of screen</div> 
    <div class="img">needs to be smooth</div> 
    <div class="img"></div> 
    <div class="img"></div> 
</div> 

乾杯

+0

請參考:http://stackoverflow.com/questions/1150163/stretch-and-scale-a-css-image-in-the-background-with-css-only – Marco

+0

修復您的報價:''背景:url(「../../ img/followers/followers-tabs.png」)no-repeat 0 0px;「'to'」background:url('../../ img/followers/followers-tabs .png')no-repeat 0 0px;「' – j08691

+0

請問你可以加小提琴嗎? –

回答

0

background-image:url('image path'); 把這個代碼塊在烏拉圭回合的CSS並獲得背景圖像設置。

2

刪除雙引號和使用單引號,而不是像這樣

"background: url('../../img/followers/followers-tabs.png') 
+0

請問可以加小提琴嗎? –

0
.container { 
height:300px; 
width:100%; 
background-image: url("Put your image link here."); 
} 

會爲內嵌樣式的工作:

<div class="container" style="background: url('Put your image link here.') no-repeat 0 0px;"></div> 

​​

+0

由於編程原因,我需要執行內聯css。 –

+0

對不起!我也忘了保存修改的小提琴。以前的答案也可以,你只需要將雙引號改爲單引號即可。 –

0

您需要刪除從qoutes網址

<div class="container" style="background: url(../../img/followers/followers-tabs.png) no-repeat 0 0px;"></div> 

您可以使用',但url在CSS背景中完全不需要它們。

下面是固定小提琴:http://jsfiddle.net/7Gacp/10/

要傳播的背景,你可以使用

background-size: 100% 100%; 

這裏還有一個小提琴:http://jsfiddle.net/7Gacp/11/