<html>
<head>
<title>test</title>
<style>
body{ TEXT-ALIGN: center; }
#center{ MARGIN-RIGHT: auto;
MARGIN-LEFT: auto;
height:200px;
background:#F00;
width:400px;
vertical-align:middle;
line-height:200px;
/* 说明:
vertical-align:middle;表示行内垂直居中,将行距增加到和整个DIV一样高line-height:200px;然后插入文字,就垂直居中了。
*/
}
</style>
</head>
<body>
<div id="center"><p>test middle</p></div>
</body>
</html>

相关文章:

  • 2021-12-02
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-11-21
  • 2022-12-23
  • 2022-12-23
  • 2021-11-21
猜你喜欢
  • 2022-12-23
  • 2021-05-17
  • 2022-12-23
  • 2021-07-06
  • 2021-11-20
  • 2021-11-21
  • 2022-12-23
相关资源
相似解决方案