首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > asp.net >

请问asp.net 页面设置有关问题

2012-04-21 
请教asp.net 页面设置问题我想在form中插入背景图片,并且网页中左右边界中没有空白的,也就是网页的左右、上

请教asp.net 页面设置问题
我想在form中插入背景图片,并且网页中左右边界中没有空白的,也就是网页的左右、上边界处不要有边距(如果能用表格实现也行)?先谢谢热心的大虾.

[解决办法]

C# code
<html><head>    <title></title>    <style>     *{margin:0;padding:0;}    .bodys    {        width:100%; height:900px; border:1px solid red;    }    </style></head><body>    <div class="bodys">        </div></body></html>
[解决办法]
C# code
<html><head>    <title></title>    <style>     *{margin:0;padding:0;}    .bodys    {        width:100%; height:900px; border:1px solid red;    }    </style></head><body>    <div class="bodys">        </div></body></html>
[解决办法]
<style type="text/css">
body 

background-image:url(<%=backgroundImage%>);
}
 </style>
 using System.Web.UI.HtmlControls;


protected override void OnInit(EventArgs e)
{
// Define an Literal control.
HtmlGenericControl css = new HtmlGenericControl();
css.TagName = "style";
css.Attributes.Add("type", "text/css");

string imageURL = string.Empty;

//Logic to determin imageURL goes here

//Update Tag
css.InnerHtml = @"body{background-image: url(" + imageURL + ");}";


// Add the Tag to the Head section of the page.
Page.Header.Controls.Add(css);

base.OnInit(e); } 

public string backgroundImage = "defaultImage.png";

或者:
<body style="background-image:url(bgr.jpg);">
...
</body>
[解决办法]
C# code
<html><head>    <title></title>    <style>     *{margin:0;padding:0;}    .bodys    {        width:100%; height:900px; border:1px solid red;background-image:url(bgr.jpg);    }    </style></head><body>    <div class="bodys">        </div></body></html> 

热点排行