HTML5 如何制作背景

img


HTML5 如何制作蓝白色这个背景,如果可以,请附上类似代码0000000000000。

参考这个

img


颜色你自己 换一下


<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <style>
    * {
      margin: 0;
      padding: 0;
    }

    .box {
      width: 100%;
      height: 100%;
    }

    .top {
      width: 100%;
      height: 300px;
      background: burlywood;
      position: relative;
    }

    .card {
      width: 90%;
      height: 300px;
      margin: 0 5%;
      position: absolute;
      top: 250px;
      background: white;
      border-radius:10px ;
      border: 1px solid gainsboro;
    }
  </style>
</head>

<body>
  <div class="box">
    <div class="top">
      <div class="card">

      </div>
    </div>
  </div>
</body>
<script>

</script>

</html>

background blue呗 。
两个div定位就行


<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <style>
    body {
      background-color: black;
    }
    div {
      width: 200px;
      height: 600px;
      background: linear-gradient(blue 0, blue 50%, #eee 51%, #eee 100%);
    }
  </style>
</head>
<body>
  <div></div>
</body>
</html>

img