CSS使asp.net 居中? 怎么操作?
比如如下代码:<%@PageLanguage="C#"AutoEventWireup="true"CodeBehind="ShowArticle.aspx.cs"Inhe...
比如如下代码:
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="ShowArticle.aspx.cs" Inherits="Blog.ShowArticle" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>无标题页</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:FormView ID="FormView1" runat="server" AllowPaging="True"
DataSourceID="SqlDataSource1">
<ItemTemplate>
<%# Eval("Title") %>
<hr />
<%# Eval("Author") %>
<br /><br />
<%# Eval("Content") %>
<hr />
</ItemTemplate>
</asp:FormView>
<br />
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:BlogConnectionString %>"
onselecting="SqlDataSource1_Selecting"
SelectCommand="SELECT * FROM [Article] WHERE ([Title] = @Title)">
<SelectParameters>
<asp:QueryStringParameter DefaultValue="1" Name="Title"
QueryStringField="Title" Type="String" />
</SelectParameters>
</asp:SqlDataSource>
<br />
<br />
</div>
</form>
</body>
</html>
怎么在CSS中控制
body属性写了无效?
怎么做呢?
<center></center>把form包围亦无效? 展开
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="ShowArticle.aspx.cs" Inherits="Blog.ShowArticle" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>无标题页</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:FormView ID="FormView1" runat="server" AllowPaging="True"
DataSourceID="SqlDataSource1">
<ItemTemplate>
<%# Eval("Title") %>
<hr />
<%# Eval("Author") %>
<br /><br />
<%# Eval("Content") %>
<hr />
</ItemTemplate>
</asp:FormView>
<br />
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:BlogConnectionString %>"
onselecting="SqlDataSource1_Selecting"
SelectCommand="SELECT * FROM [Article] WHERE ([Title] = @Title)">
<SelectParameters>
<asp:QueryStringParameter DefaultValue="1" Name="Title"
QueryStringField="Title" Type="String" />
</SelectParameters>
</asp:SqlDataSource>
<br />
<br />
</div>
</form>
</body>
</html>
怎么在CSS中控制
body属性写了无效?
怎么做呢?
<center></center>把form包围亦无效? 展开
7个回答
展开全部
在form外增加一个div,即:
<div style="width:960px; margin:0 auto;">
<form .....>
</form>
</div>
PS:其中div的宽度一定要设定。。
<div style="width:960px; margin:0 auto;">
<form .....>
</form>
</div>
PS:其中div的宽度一定要设定。。
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="ShowArticle.aspx.cs" Inherits="Blog.ShowArticle" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>无标题页</title>
</head>
<body>
<form id="form1" runat="server">
<div style="margin: 0 auto;text-align:center">
<asp:FormView ID="FormView1" runat="server" AllowPaging="True"
DataSourceID="SqlDataSource1">
<ItemTemplate>
<%# Eval("Title") %>
<hr />
<%# Eval("Author") %>
<br /><br />
<%# Eval("Content") %>
<hr />
</ItemTemplate>
</asp:FormView>
<br />
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:BlogConnectionString %>"
onselecting="SqlDataSource1_Selecting"
SelectCommand="SELECT * FROM [Article] WHERE ([Title] = @Title)">
<SelectParameters>
<asp:QueryStringParameter DefaultValue="1" Name="Title"
QueryStringField="Title" Type="String" />
</SelectParameters>
</asp:SqlDataSource>
<br />
<br />
</div>
</form>
</body>
</html>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>无标题页</title>
</head>
<body>
<form id="form1" runat="server">
<div style="margin: 0 auto;text-align:center">
<asp:FormView ID="FormView1" runat="server" AllowPaging="True"
DataSourceID="SqlDataSource1">
<ItemTemplate>
<%# Eval("Title") %>
<hr />
<%# Eval("Author") %>
<br /><br />
<%# Eval("Content") %>
<hr />
</ItemTemplate>
</asp:FormView>
<br />
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:BlogConnectionString %>"
onselecting="SqlDataSource1_Selecting"
SelectCommand="SELECT * FROM [Article] WHERE ([Title] = @Title)">
<SelectParameters>
<asp:QueryStringParameter DefaultValue="1" Name="Title"
QueryStringField="Title" Type="String" />
</SelectParameters>
</asp:SqlDataSource>
<br />
<br />
</div>
</form>
</body>
</html>
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
把一下样式插入到head
<style type="text/css" >
body
{
text-align:center;
}
</style>
<style type="text/css" >
body
{
text-align:center;
}
</style>
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
body 属性中写上:
text-align:center;
margin:0px auto;
text-align:center;
margin:0px auto;
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
如果楼上 δCat回答者还不能见效的话,还有一种最实用也是最笨的办法,用padding来写,但需要不断的调整它的间距。
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询