需要asp.net内容页面的帮助

时间:2021-12-25 22:02:42

Somebody please help me how to place the content page in center of the page.I am trying to do using css class but content doesn't have css property.In my application when i am clicking on LOGIN DETAILS , that page should open in the center but opening under the menu item. Here is my code:

有人请帮我如何将内容页面放在页面的中心。我正在尝试使用css类但内容没有css属性。在我的应用程序中,当我点击LOGIN DETAILS时,该页面应该在中心,但在菜单项下打开。这是我的代码:

4 个解决方案

#1


The auto value on the left and right margins work to center the div horizontally. Unfortunately this doesn't work vertically, so you may need to set this manually or detected the screen resolution dynamically.

左右边距上的自动值可以使div水平居中。不幸的是,这不能垂直工作,因此您可能需要手动设置或动态检测屏幕分辨率。

<div id="loginBox">
..login form here
</div>

<style>
#loginBox {
  width:400px;
  height:300px;
  margin:400px auto 0px auto;
}
<style>

#2


As the other posters have said, you will need to use CSS to position the div in the center of the screen.

正如其他海报所说,你需要使用CSS将div定位在屏幕的中心。

Here's some quick code to help you with this.

这里有一些快速代码可以帮助您解决这个问题。

div#centered {
    background-color: #eee; 
    border: 1px solid #ddd; 
    position: absolute; 
    left: 50%; 
    top: 50%;  
    width: 400px;  
    height: 300px; 
    margin-left: -200px;  
    margin-top: -150px;
}

And it's usage:

它的用法是:

<div id="centered"><!-- your login stuff --></div>

#3


Put your contentplaceholder in a <div> and then center the div?

将您的contentplaceholder放在

中然后居中div?

#4


Content place holder is a virtual container, it doesn't effect your page's visualization. Think it as a LiteralControl. So you should design your contentplaceholder's surrounding elements.

内容占位符是一个虚拟容器,它不会影响页面的可视化。将其视为LiteralControl。因此,您应该设计contentplaceholder的周围元素。

#1


The auto value on the left and right margins work to center the div horizontally. Unfortunately this doesn't work vertically, so you may need to set this manually or detected the screen resolution dynamically.

左右边距上的自动值可以使div水平居中。不幸的是,这不能垂直工作,因此您可能需要手动设置或动态检测屏幕分辨率。

<div id="loginBox">
..login form here
</div>

<style>
#loginBox {
  width:400px;
  height:300px;
  margin:400px auto 0px auto;
}
<style>

#2


As the other posters have said, you will need to use CSS to position the div in the center of the screen.

正如其他海报所说,你需要使用CSS将div定位在屏幕的中心。

Here's some quick code to help you with this.

这里有一些快速代码可以帮助您解决这个问题。

div#centered {
    background-color: #eee; 
    border: 1px solid #ddd; 
    position: absolute; 
    left: 50%; 
    top: 50%;  
    width: 400px;  
    height: 300px; 
    margin-left: -200px;  
    margin-top: -150px;
}

And it's usage:

它的用法是:

<div id="centered"><!-- your login stuff --></div>

#3


Put your contentplaceholder in a <div> and then center the div?

将您的contentplaceholder放在

中然后居中div?

#4


Content place holder is a virtual container, it doesn't effect your page's visualization. Think it as a LiteralControl. So you should design your contentplaceholder's surrounding elements.

内容占位符是一个虚拟容器,它不会影响页面的可视化。将其视为LiteralControl。因此,您应该设计contentplaceholder的周围元素。