2015-06-20 105 views
0

确定,所以我尝试让我的背景图像使用适当规模从桌面到移动代码IM是:HTML/CSS图像缩放,移动

CSS

@media (max-width:500px){ 
#homepage{ 
padding-right: 5%; 
padding-bottom: 80px; 
position: relative; 
background-size: cover ; 
background-position: center; 
background-attachment: fixed; 
background-repeat: no-repeat; 
background-image: url(../img/bg-mobile.jpg); 
height: 100%; 
} 
} 

与编码图像大小在移动显示大约35x65px(图像“BG - 移动”是337XX 667高度作为发现,CSS代码应该工作,但它不能有人请帮助我(对不起,我不知道具体我可以更具体)

+0

你能请与HTML和CSS的小提琴。 我想我可以帮助你。 – Brain

+0

也许有另一个CSS规则正在改变背景图像的行为。正如大脑已经说过,请提供一个JS小提琴或类似的东西,以获得更多的上下文 – 2015-06-20 23:43:10

+0

js提琴手wasnt能够加载我的电脑,ive上传网站rar文件到谷歌驱动器,并能够下载(我希望多数民众赞成)https ://drive.google.com/file/d/0BxQmwgeZ27_0alZlYWlaeVp1QWM/view?usp =分享 – swiftdh0

回答

0
background-position: center center; 
+0

更改没有影响:(,感谢快速响应 – swiftdh0

0

也许最好是按比例缩放图像的分辨率。

HTML

<div class="img_resz"> 
    <img src="img.jpg"> 
</div> 

CSS

.img_resz img 
{ 
    width: 50%; 
}