老师这样写 符合要求吗?

来源:2-12 自由编程

TheRoo

2021-07-02 09:53:57

<!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>

      * {

        padding0;

        margin0;

      }

      .container {

        width100%;

        height667px;

        background-colorgray;

      }

      .inner {

        width50%;

        background-color#fff;

        border-radius5px;

        positionabsolute;

        top50%;

        left50%;

        transformtranslate(-50%-50%);

      }

      .inner p {

        font-size25px;

        displayinline-block;

        width100%;

        height80px;

        line-height80px;

        text-aligncenter;


      }

      .inner .btn-container {

        width100%;

        height50px;

        displayflex;

        justify-contentcenter;

        align-itemscenter;

        margin20px auto;

      }

      button {

        width100px;

        font-size20px;

        colorwhite;

        border-radius5px;

        text-aligncenter;

        line-height50px;

      }

      .btn1 {

        background-colorblue;

        margin-right20px;

      }

      .btn2 {

        background-colorgray;

        opacity0.8;

      }

    </style>

  </head>


  <body>

    <div class="container">

      <div class="inner">

        <p>确认要删除吗?</p>

        <div class="btn-container">

          <button class="btn1">确认</button>

          <button class="btn2">取消</button>

        </div>

      </div>

    </div>

  </body>

</html>



写回答

1回答

好帮手慕言

2021-07-02

同学你好,参考下方:

1、外层大盒子设置一个半透明的背景色 ,高度不建议设置成固定值,可以设置为百分比,如下:

http://img.mukewang.com/climg/60de7dc6091a863305710447.jpg

2、内层盒子的样式可以再调整一下,让效果更美观,代码参考:

http://img.mukewang.com/climg/60de81cf0995b07804500133.jpg

http://img.mukewang.com/climg/60de81e1098f5d2f04480316.jpg

http://img.mukewang.com/climg/60de825609f9f21903930162.jpg

http://img.mukewang.com/climg/60de82f1094a580504410413.jpg

祝学习愉快~


0

0 学习 · 15276 问题

查看课程