网页高度垂直居中

网页高度垂直居中,第1张

概述网页高度垂直居中

下面是内存溢出 jb51.cc 通过网络收集整理的代码片段。

内存溢出小编现在分享给大家,也给大家做个参考。

<!DOCTYPE HTML><HTML><head><Meta http-equiv="Content-Type" content="text/HTML; charset=utf-8"><Title>无标题文档</Title><style type="text/CSS">	*{         margin: 0;padding: 0;       }	   body{			background-color:#63F;			position:relative;			display:block;			wIDth:100%;			height:100%;	   }	div{		margin:auto;		position:relative;		border: 1px solID gray;		top:50%;	}	  #D1{	  background-color:#F00;	  wIDth:100px;	  height:100px;	  margin-top:-50px;	  }	#D2{		background-color:#0F0;		wIDth:200px;		height:200px;		margin-top:-100px;	}	#D3{		background-color:yellow;		wIDth:300px;		height:300px;		margin-top:-150px;	}	#D4{		background-color:#0FF;		wIDth:400px;		height:400px;		position:fixed;		margin-top:-200px;		left:50%;		margin-left:-200px;		}</style></head><div ID='D4'><div ID='D3'><div ID='D2'><div ID='D1'></div></div></div></div><body></body></HTML>

以上是内存溢出(jb51.cc)为你收集整理的全部代码内容,希望文章能够帮你解决所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

总结

以上是内存溢出为你收集整理的网页高度垂直居中全部内容,希望文章能够帮你解决网页高度垂直居中所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址:https://54852.com/web/1097626.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2022-05-28
下一篇2022-05-28

发表评论

登录后才能评论

评论列表(0条)

    保存