Skip to content

Instantly share code, notes, and snippets.

@qianduan
Created December 18, 2012 08:46
Show Gist options
  • Save qianduan/4326240 to your computer and use it in GitHub Desktop.
Save qianduan/4326240 to your computer and use it in GitHub Desktop.

Revisions

  1. qianduan created this gist Dec 18, 2012.
    15 changes: 15 additions & 0 deletions center.html
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,15 @@
    <!DOCTYPE HTML>
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <title>只是文字的水平和垂直居中</title>
    <style>
    html,body{width: 100%;height: 100%;margin: 0;padding: 0}
    body{background-color: green;display: table;}
    p{line-height: 1.6;text-align: center;padding: 0;margin: 0;display: table-cell;vertical-align: middle;}
    </style>
    </head>
    <body>
    <p>wording</p>
    </body>
    </html>