.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;
}
答案 0 :(得分:0)
尝试设置:
background-color: transparent;
的孩子们。