js水平居中
<!DOCTYPE html>?
<html>?
<head>?
<meta charset="utf-8">?
<meta name="author" content="http://www.softwhy.com/" />?
<title>為什么text-align:center無法將div水平居中-螞蟻部落</title>?
<style type="text/css">
div{
? width:700px;
? height:700px;
? font-size: 30px;
? background-color:green;
}
#children{
? ? padding-top: 60px;
? ? width: 600px;
? ? height: 400px;
? ? background-color: red;
? ? margin: 0px auto;
? ? text-align: center;
? ? font-size: 30px;
}
</style>
</head>
<body>
<h1 >'margin: 0px auto;讓div 左右居中' </h1>
<html>?
<head>?
<meta charset="utf-8">?
<meta name="author" content="http://www.softwhy.com/" />?
<title>為什么text-align:center無法將div水平居中-螞蟻部落</title>?
<style type="text/css">
div{
? width:700px;
? height:700px;
? font-size: 30px;
? background-color:green;
}
#children{
? ? padding-top: 60px;
? ? width: 600px;
? ? height: 400px;
? ? background-color: red;
? ? margin: 0px auto;
? ? text-align: center;
? ? font-size: 30px;
}
</style>
</head>
<body>
<h1 >'margin: 0px auto;讓div 左右居中' </h1>
<h1 >'text-align: center;讓div里面的文本或圖片左右居中' </h1>
<div style="margin: 0px auto;"> 綠色我是父div
? ? ? <div id="children">
? ? ? ? ? ? <p >我是子div的文本,我居中 </p>
? ? ? </div>
</div>
</body>
總結(jié)
- 上一篇: 怎么看计算机电源型号,鲁大师怎么看电源
- 下一篇: 动态社区网络前沿研究