标题的背景图像
问题描述:
我想将背景图像添加到标题并为其设置背景位置。 Here`s我的代码不工作..标题的背景图像
HTML
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>Home</title>
<!-- Meta viewport tag is to adjust to all Mobile screen Resolutions-->
<meta name="viewport"
content="width=device-width, initial-scale=1, maximum-scale=1" />
<link rel="stylesheet" type="text/css" href="css/style.css" />
<link rel="stylesheet" type="text/css" href="css/Jstyle.css" />
<script type="text/javascript" src="Javascript/jquery1.js"></script>
<script type="text/javascript" src="Javascript/jquery2.js"></script>
</head>
<body>
<div data-role="page" id="project">
<div data-role="header" class="header"></div>
<div id="ad" align="center">
<img alt="image" src="images/ad.png">
</div>
<div data-role="content">
<div id="product" align="center">
<img alt="image2" src="images/product.png">
</div>
<!-- Style card -->
<div id="style" align="center">
<img alt="image2" src="images/style_card.png">
</div>
<!-- Social -->
<div id="social" align="center">
<img alt="image2" src="images/app_store.png"> <img
alt="image2" src="images/social.png">
</div>
</div>
</div>
</body>
CSS:
.header{
background-image:url("images/image_bg_inner.png");
width:200px;
background-color: #B00C0C;
}
试图与.ui-header
也..和它`不工作。请帮我,我怎么可以这样做..
答
尝试:
.header {
width:200px;
background-image:url("images/image_bg_inner.png");
}
也许background-color
与background-image
冲突。
或者:
添加高度,以你的头。
.header {
width:200px;
background-color: #B00C0C;
background-image:url("images/image_bg_inner.png");
min-height:70px;
}
+0
希望这有助于;) – 2013-02-14 09:58:48
+0
谢谢Aqib :) – Ashwin 2013-02-14 10:23:55
答
尝试:
.ui-bar-a{
background-image:url("images/image_bg_inner.png");
width:200px;
background-color: #B00C0C;
}
如果使用的是另一个主题改变.UI吧-B等宽200像素,似乎该元素在奇数关系吗?
答
这对我来说很好。
<style type="text/css">
.ui-header {
height:200px; /* any height */
background-image:url(newlogo.png);
background-repeat:no-repeat;
background-position:center;
}
</style>
什么不起作用?它不显示图像? – 2013-02-14 09:53:13
你的标题是空的?所以也许没有高度? – 2013-02-14 09:53:27
@ axel.michel对!他应该使用'min-height'属性;)或者如果他的标题高度将是固定值,那么'height' – 2013-02-14 09:54:10