2013-10-14 45 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/