[英]Background image show in Firefox but not in IE, might be z-index issue
[英]Background image doesn't show in firefox and IE
我是引导程序和整体Web设计的新手。 使用原始的bootstrap.css和bootstrap的默认html文件,将其添加为自定义css:
body {
margin: 0;
background: url("some image url");
background-position: center top;
background-size: 1440px 800px;
background-repeat:no-repeat;
display: compact;
}
并且它在chrome上可以正常工作,但在IE或Firefox中却无法显示。 使用萤火虫,我检查了CSS并得到了:
body {
background: url("some image url") repeat scroll center top / 1440px 800px rgba(0, 0, 0, 0);
margin: 0;
}
但是我仍然不知道问题出在哪里。 还有其他方法可以编写简单的CSS代码段,以便IE和firefox可以使用它吗?
编辑:我解决了分号问题,但仍然没有出现。 萤火虫显示:
body {
margin: 0;
background: url("some image url");
background-position: center top;
/* background-size: cover; */
background-size: 1440px 800px;
background-repeat:no-repeat;
display: compact;
}
编辑:我不得不把直接路径到图像与使用URL。 谢谢大家的建议和帮助!
http://www.w3schools.com/css/css_background.asp
你需要改变
background: url("some image url");
成
background-image: url("some image url");
您好@tyrell_c我认为问题可能是Firefox不支持“ display:compact”,也请尝试省略图片网址中的引号
好吧,所有其他答案都很好,我总是使用它们,但是如果它们不起作用,您可能会做一个简单的技巧,例如在刚开始的身体上添加img,并将其高度和宽度设置为100%,以使照片成为根据屏幕尺寸做出响应。这将拉伸照片,并且对用户而言将像背景照片一样,因为它看起来相同
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.