CSS的水平与垂直中心

In Internet Observation  ||  2007 ||  Tags: CSS  ||  Readers: 730

预览:http://www.456bereastreet.com/lab/centered/both/
代码:
 <style type="text/css" media="screen,print">
 html,
 body {
  margin:0;
  padding:0;
  font-family:"Trebuchet MS", Georgia, Verdana, serif;
  color:#000;
  background:#ccc;
 }
 h1 {
  padding:0;
  margin:0;
  font-size:16px;
 }
 p {
  margin:9px 0 0 0;
  padding:0;
  font-size:12px;
  line-height:18px;
 }
 p+p {
  font-style:italic;
  font-size:11px;
 }
 /* styles for IE 5 Mac */
 #centerwrap {
  background-color:#fcc;
  width:720px;
  height:420px;
  margin:10px auto;
  position:relative;
 }
 
 #content {
  background-color:#fff;
  position:absolute;
  top:10px;
  left:10px;
  height:380px;
  width:670px;
  padding:10px 20px 10px 10px;
  overflow:auto;
 }
 /* commented backslash hack  - invisible to IE 5 \*/
 #centerwrap {
  position:absolute;
  margin:-210px 0 0 -360px;
  left:50%;
  top:50%;
 }
 /* end hack */
 </style>
Click "Comment" to broadcast and share your opinions and experience. Click "Tool Box"-> "Save" to add this article as your favourite.

Drill-down:

It is used to describe articles that are stemmed from a single lead article that give a more in-depth or detailed information of the same subject.