Skip to content

网页排版

版心

版心通常是固定宽度,并且居中于整个视口

css
.w{
  width:1240px;
  margin:0 auto;
}

image-20251022224608437

html
<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <link rel="stylesheet" href="./css/base.css" />
    <style>
      .logo {
        width: 200px;
        height: 88px;
      }
      .logo h1 {
        height: 100%;
      }
      .logo a {
        display: block;
        height: 100%;
        width: 100%;
        text-indent: -9999px;
        overflow: hidden;
        background: url(./logo.png) no-repeat center/contain;
      }
    </style>
  </head>
  <body>
    <div class="logo">
      <h1><a href="#" title="小兔鲜儿">小兔鲜儿</a></h1>
    </div>
  </body>
</html>