CSS的水平与垂直中心
Posted by admin on November 18, 2007 in 朝花夕拾 Views:461 views
译者:Sylvia_Queen
预览: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>
More: continued here
Last 5 posts in 朝花夕拾
- 人间天堂-美得让人窒息的小村庄(转载) - October 23rd, 2008
- mysqldump数据库操作命令 - June 30th, 2008
- 经典猴故事 - June 13th, 2008
- 160亿像素的图片!——达芬奇的《最后的晚餐》 - January 2nd, 2008
- 订阅新闻 - November 19th, 2007
Comment
Log in or Register to post a comment.