html - 如何在网页中制作全屏背景

标签 html css web

如何制作一个图像作为网页的背景,而不考虑显示该网页的屏幕尺寸?我想正确显示它。怎么办?

最佳答案

很简单 使用此 css(将 image.jpg 替换为您的背景图片)

body{height:100%;
   width:100%;
   background-image:url(image.jpg);/*your background image*/  
   background-repeat:no-repeat;/*we want to have one single image not a repeated one*/  
   background-size:cover;/*this sets the image to fullscreen covering the whole screen*/  
   /*css hack for ie*/     
   filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='.image.jpg',sizingMethod='scale');
   -ms-filter:"progid:DXImageTransform.Microsoft.AlphaImageLoader(src='image.jpg',sizingMethod='scale')";
}

关于html - 如何在网页中制作全屏背景,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10869739/

相关文章:

html - Div 标题在网页上不对齐

css - Google 字体显示为 Comic Sans?

c++ - 如何在控制台应用程序中显示网站的源代码?

web - polymer 中的双括号 [[ ]] 与双括号 {{ }}

javascript - Material Design 中不显示移动菜单

javascript - 从 JavaScript 更改文本字段

javascript - Toggle 未按预期运行

css - 滑动门 CSS、按钮标签和 IE8

c# - Css 更改 asp tablecell,而不调整它的大小

javascript - firestore get 方法完成后执行代码