jquery - 无法将图像作为背景。手机版

标签 jquery html css

编辑:我用这个修复了它:

.element{
 position: relative;
 top: 40%;
 transform: translateY(-50%);
 width:50%;
 margin-left:auto;
 margin-right:auto;
 }

好的,所以我无法使用 jquery mobile 在我的页面上使用 img 作为背景。

我想要一张图片作为我的背景。但我想不通。

那么我怎样才能让它工作呢?

这是我的 html:

<!doctype html>
<html lang="en">
<head>
<title></title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, user-scalable=false"> 
<link rel="stylesheet" href="css/styles.css">
<link rel="stylesheet" href="themes/mobilethemes.min.css" />
<link rel="stylesheet" href="themes/jquery.mobile.icons.min.css" />
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.4.3/jquery.mobile.structure-1.4.3.min.css" />
<script src="http://code.jquery.com/jquery-1.11.1.min.js"></script>
<script src="http://code.jquery.com/mobile/1.4.3/jquery.mobile-1.4.3.min.js"></script>

<!-- allows to store on desktop for IOS -->
<link rel="apple-touch-icon" href="icon.png" />
<meta name="apple-mobile-web-app-capable" content="yes" />

</head>
 <body>
<div data-role="page">
  <div data-role="header">
     <h1>Header</h1> 
</div>
<div data-role="content" class="welcome">
    Here is my content
</div>
<div data-role="footer">
   <h1>Footer</h1>
</div>
</div>   
</body>
</html>

我的CSS:

.ui-page, .ui-body-c, .ui-page-active, .ui-overlay-c, .ui-mobile-viewport
{
background: transparent !important;
}

body, .ui-overlay-c
{
background: url('../data/background.png') !important;
background-repeat:repeat-y !important;
background-position:center center !important;
background-attachment:scroll !important;
background-size:100% 100% !important;
}

最佳答案

尝试设置:

 background-color: transparent;

子 div 的。

关于jquery - 无法将图像作为背景。手机版,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24852890/

相关文章:

javascript - 按名称调用 Javascript 函数

java - 将 CSS 添加到 JasperReports 的 HTML 导出

javascript - 具有各种高度的 jquery 可排序 block

html - 我怎样才能让这些元素在同一行?

html - 使用 `href` 属性作为 CSS 背景图像

javascript - 使用 CSS/Javascript/JQuery 分隔表格单元格

javascript - 在特定日期和时间突出显示下一个 <li>

javascript - JSONP 和 Google map 方向 API

javascript - 从第一个调用的 promise 中获取第二个调用的响应

javascript - 没有折叠的相同导航栏