编程技术网

关注微信公众号,定时推送前沿、专业、深度的编程技术资料。

 找回密码
 立即注册

QQ登录

只需一步,快速开始

极客时间

Internet Explorer 无法识别“html"css 背景图像标签?:Internet Explorer doesn't recognise the 'html' css background image tag?

Steffy-zxf 机器学习 2022-5-7 09:31 7人围观

腾讯云服务器
Internet Explorer 无法识别“html"css 背景图像标签?的处理方法

我基本上想知道是否有解决方法?我正在重新设计我的老人管道网站,并从这个网站 http://visitmix.com/ 他们使用 body css 标签作为标题背景,并在主要网站正文中使用一些重叠设计 - 以及 html css 标签作为网页其余部分的背景重复图像.虽然这适用于 Firefox 和 chrome,但 Internet Explorer 背景只是背景颜色.

I was basically wondering if there was a work around to this? I was redesigning my old mans plumbing website, and took a few of the ideas from this website http://visitmix.com/ where they used the body css tag as the header background with a few overlapping designs into the main website body - and the html css tag for the background repeating image of the rest of the webpage. While this works in firefox and chrome, the internet explorer background is just the background color.

我正在开发的网站在这里:http://www.plumberkendal.co.uk 这说明了我的意思.我用html css标签的宽度和高度尝试了很多东西,但无济于事..这是有问题的css:

The website I'm working on is here: http://www.plumberkendal.co.uk which shows what I mean. I've tried numerous things with the width and the height of the html css tag but to no avail.. heres the css in question:

html { background-image: url("../images/html_bg.png"); background-repeat: repeat; background-color: #5a84c5; height: auto; width: auto; } body { padding-top: 0px; margin-top: 0px; margin-right: 0px; margin-left: 0px; margin-bottom: 0px; padding-bottom: 0px; background-image: url("../images/header_bg.png"); background-repeat: no-repeat; background-position: center top; text-align: center; } 

任何帮助将不胜感激,与 css 的跨浏览器兼容性是一个让我非常困惑的领域!

Any help would be greatly appreciated, cross-browser compatibility with css is an area that really confuses me!

问题解答

你应该将背景分配给正文选择器,而不是 HTML 标签:

You should assign the background to the body selector, not the HTML tag:

body { background-image: url("../images/html_bg.png"); padding-top: 0px; margin-top: 0px; ... } 

将其分配给 HTML 选择器将不起作用,因为 HTML 包含 head 元素和正文,并且通常不被视为具有背景的对象.

Assigning it to the HTML selector will not work as the HTML contains the head element as well as the body, and is not generally treated as an object that has a background.

将其分配给正文选择器将忽略 <html><head> 标记并将其放在页面的主体上,显示背景符合预期.

Assigning it to the body selector will ignore the <html> and <head> tags and put it right onto the main body of your page, displaying the background as intended.

(如果其他人可以更好地解释这一点,请继续!):)

(If anyone else can explain this better, go ahead!) :)

这篇关于Internet Explorer 无法识别“html"css 背景图像标签?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程技术网(www.editcode.net)!

腾讯云服务器 阿里云服务器
关注微信
^