如何将我的内容页面数据放在页面中间 [英] How to place my content page data in the middle of the page

查看:80
本文介绍了如何将我的内容页面数据放在页面中间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有母版页面和内容页面....我想在中间设置我的内容页面数据...并且还想知道如何在母版页绝对位置中将contentplaceholder放在一起



我尝试了什么:



主页:





< asp:ContentPlaceHolder ID =contentrunat =server>







内容页面:



< asp:Content ID =Content1ContentPlaceHolderID =content

runat =server> < link rel =stylesheethref =css / StyleSheet.csstype =text / cssmedia =screen/>

.........

...........

............



解决方案

您的内容页面没有任何发送到客户端的标记(除了您自己添加的标记),它们只是控件的服务器端容器。如果你想集中你的内容,你需要将你的内容占位符包装在一个div中,并使用适当的css



 #content { 
position: fixed ;
/ * 将元素居中* /
右: 0 ;剩余
0 ;
margin-right:auto;
margin-left:auto;
/ * 给它尺寸* /
min-height:10em;
宽度:90%;
}





在您的主页上



 <   div     id   =  content >  
< asp:ContentPlaceHolder ID = ContentPlaceHolder1 runat = 服务器 >

< span class =code-keyword>< / asp:ContentPlaceHolder >
< / div >


i have master page and content page....i want to set my content page data in the middle...and also want to know how to maky the contentplaceholder in master page absolute position

What I have tried:

master page:


<asp:ContentPlaceHolder ID="content" runat="server">




content page:

<asp:Content ID= "Content1" ContentPlaceHolderID = "content"
runat="server"> <link rel="stylesheet" href="css/StyleSheet.css" type="text/css" media="screen" />

.........
...........
............

解决方案

Your content pages don't have any mark-up that is sent to the client (other than the mark-up you add yourself), they are simply a server-side container for your controls. If you want to centre your content you'll need to wrap your content placeholder in a div with the appropriate css

#content{
    position: fixed;
    /* center the element */
    right: 0;
    left: 0;
    margin-right: auto;
    margin-left: auto;
    /* give it dimensions */
    min-height: 10em;
    width: 90%;
}



On your master page

<div id="content">
    <asp:ContentPlaceHolder ID="ContentPlaceHolder1" runat="server">
        
    </asp:ContentPlaceHolder>
</div>


这篇关于如何将我的内容页面数据放在页面中间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆