admin管理员组

文章数量:1610898

不是前端,做前端的活真是寸步难行,一个居中就搞了好久

<html>
<head>
<meta charset="utf-8"> 
<title></title> 
<style>
.pos_fixed
{
	position:fixed; 
	margin:auto;
	left:0;
	right:0;
	bottom:10px;
	width:300px;
	background:red;
	text-align:center;
}
</style>
</head>
<body>
<p class="pos_fixed">阿斯顿发送到发是</p>
</body>
</html>

想要居中,对于 margin:auto; left:0; right:0; width:300px;这几个属性一个都不能少,别小看width,没它就无法居中。
bottom:10px; 是距离底部的距离,根据自己的需要来调整。
text-align:center; 并不是用来指定p的居中,而是用来指定p中的文字相对于p居中

本文标签: Positionfixed