DIV 居中
来源:互联网 发布:linux 查看内核参数 编辑:程序博客网 时间:2024/04/29 04:25
方法1:
<style type="text/css">
.LoadCenterProgress
{
height: 25px;
width: 300px;
background-color: #FAD163;
line-height: 25px;
color: #00C;
text-align:center;
position:absolute;
top:50%;
left:50%;
margin-top:-13px;
margin-left:-150px;
}
</style>
<div class="LoadCenterProgress" id="progressDiv" >
Load ...
</div>
原理: margin-left = -width/2
方法2:
.LoadCenterProgress2
{
height: 25px;
width: 300px;
background-color: #FAD163;
line-height: 25px;
color: #00C;
text-align:center;
position:absolute;
left:expression((this.parentElement.offsetWidth-this.offsetWidth)/2);
top:expression((this.parentElement.offsetHeight-this.offsetHeight)/2);
}
优点:动态计算width/2, 此方法好像在Popup中会无效?
附带UpdatePanel的用法:
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<asp:UpdateProgress ID="UpdateProgress1" runat="server">
<ProgressTemplate>
<div class="LoadCenterProgress" id="progressDiv" >
Shipping ...
</div>
</ProgressTemplate>
</asp:UpdateProgress>
<asp:UpdatePanel ID="UpdatePanel" runat="server" UpdateMode="always">
<ContentTemplate>
some html
</ContentTemplate>
</asp:UpdatePanel >
- div 居中
- DIV 居中
- div 居中
- div居中
- div居中
- div居中
- div居中
- Div居中
- Div居中
- div 居中
- DIV居中
- div居中
- div居中
- div居中
- DIV居中
- div居中
- div居中
- div居中
- pku2823_Sliding Window
- 句柄类的简单运用
- 区别Ruby的require,load,和include
- 一叶方舟博客
- C#WinFrom程序打包/图解VS2008项目的安装与部署图解
- DIV 居中
- 中国的程序员为什么这么辛苦?
- (转)如何准备一个成功的软件项目验收会
- 规律!
- C++ 运算符优先级列表
- SQL中,内连接,外连接的书写格式
- php调用存储过程返回结果集,解决can't return a result set in the given context错误的方法
- SqlServer2008 配置允许远程连接
- display the local image online base on IE and Fire fox