在母版页上显示背景图像 [英] show background image on master page
本文介绍了在母版页上显示背景图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何在母版页中设置背景图像.
how to set background image in a masterpage.
推荐答案
可能对您有帮助
您可以附加css文件或
编写如下代码...
只需在url(''imagepath'')中提供图像所在的路径即可.
谢谢:)
May be its helpful for you
you can attach the css file or
write the code as below...
just provide the path where image is located in url(''imagepath'')..
thanks :)
<pre lang="xml"><head runat="server">
<title></title>
<asp:ContentPlaceHolder id="head" runat="server">
</asp:ContentPlaceHolder>
<style type="text/css">
body
{
background-image:url('abc.jpg')
}
</style>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:ContentPlaceHolder id="ContentPlaceHolder1" runat="server">
</asp:ContentPlaceHolder>
</div>
</form>
</body>
</html>
使用CSS
body{background:url("img.jpg")}
在母版页头中设置此CSS样式表
Set this css stylesheet in your master page head
<link rel ="stylesheet" src ="master.css">
和瞧. :)
And voila. :)
该母版页与背景图片的设置无关.
解决方案是在任意位置的控件中定义图像.
由于您拥有母版页,因此它也可能位于其中.例如
The masterpage is irrelevant in setting of a background image.
The solution is to define an image in a control anywhere.
Since you have a masterpage this may as well be in there. E.g.
<div style="position:fixed; top:0; left:0; background-image:url ('image.png'); z-index:0">
</div>
要注意的重要一点是div的位置和背景Zindex.看看是否可行.
The important thing to note is the position of div and the background Zindex. See if that works.
这篇关于在母版页上显示背景图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文