html - 我的背景没有出现在某些移动浏览器上

标签 html css mobile

我知道还有一些其他类似的帖子与我的问题相关,对此深表歉意。在发布之前,我已经尝试了这些帖子中提供的所有解决方案。

我的页面上有一个表格,它有一个使用 css 的背景图片。

html
{
width:100%
height: 100%;
margin: 0px;
padding: 0px;
border: none;
}

table.homemain
{       
background: linear-gradient(rgba(0, 0, 0, 0.3), rgba(0, 0, 0, 0.3) ), url('../images/home-bg.jpg') no-repeat;
background-position: 50% 50%;
background-size: cover;
height: 100%;
width: 100%;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
}

<table class="homemain">

enter image description here

我已经将图像的大小从 90k 减小到 9k,仍然没有什么不同。 我还将 css 剥离为背景图片

background-image:url(../images/home-bg.jpg);

它仍然没有显示。

抱歉,我无法显示实时站点,它仍在我的电脑上本地托管。

任何建议将不胜感激。

干杯

约翰

最佳答案

如果您希望显示整个页面的背景图片,请将其放在 <style> </style> 中。 例如。

<style>
  body {
    background-image: url("~/images/home-bg.jpg");
  } 
</style>

确保您放入了完整的目录,因为这样就不会出现错误传达的情况。

关于html - 我的背景没有出现在某些移动浏览器上,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30934401/

相关文章:

javascript - 暂时停止单击按钮的功能

javascript - 如何检查设备时间设置是否正确?

html - 在 div 上 Bootstrap 中心进度条

javascript - float 图调整大小错误,高度无效

jquery - 如何停止图像选择

javascript - 在添加 DOM 之前创建一个 html 元素并通过 id 找到一个 div

javascript - HTML CSS 中的动画

html - ionic 侧面菜单不显示内容

json - pinterest api 文档

css - 为什么我的页脚宽度没有达到智能手机上的全宽?我正在使用 Wordpress