Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>JS Bin</title>
</head>
<body>
    <div class="wrap">
            <div class="centered">
                <p>文字有木有居中?</p>
            </div>
    </div>
</body>
</html>
 
            html, body{
                height:100%;
            }
            body{
                background:#999;
                font-size:100%;
            }
            .wrap {
                text-align: center;
                height:100%;
            }
            .wrap:before {
                content: '';
                display: inline-block;
                height: 100%;
                vertical-align: middle;
                margin-right: -0.25em;
            }
            .centered {
                display: inline-block;
                vertical-align: middle;
                width: 480px;
                background:#eee;
            }
Output

You can jump to the latest bin by adding /latest to your URL

Dismiss x
public
Bin info
anonymouspro
0viewers