麻烦老师帮忙看一下有没有什么地方可以优化改进,谢谢!

来源:4-7 编程练习

blanolic

2020-08-10 18:32:09

<!DOCTYPE html>

<html>

    <head>

        <meta charset="UTF-8">

        <title>display属性</title>

        <style type="text/css">

          /*样式补充*/

          *{margin:0; padding: 0;}

          ul{text-align: center; background-color: white; list-style: none; display: none; line-height: 2em}

          .big{width:150px; background-color: #ececec; border:0.5px solid #bebebe; margin: 0 auto;}

          h3{text-align: center; border:0.5px solid #bebebe;}

          .div1:hover ul{display: block;}

          .div2:hover ul{display: block;}

          .div3:hover ul{display: block;}

        </style>

    </head>

    <body>

    <div class="big">

        <div class="div1">

            <h3>家电</h3>

            <ul class="elec">

                <li>冰箱</li>

                <li>洗衣机</li>

                <li>空调</li>

            </ul>

        </div>

        <div class="div2">

            <h3>洗护</h3>

            <ul class="wash">

                <li>洗衣液</li>

                <li>消毒液</li>

                <li>柔顺剂</li>

            </ul>

        </div>

        <div  class="div3">

            <h3>衣物</h3>

             <ul class="clothes">

                <li>衬衫</li>

                <li>裤子</li>

                <li>卫衣</li>

            </ul>

        </div>

      </div>

</body>

</html>


写回答

1回答

好帮手慕言

2020-08-10

同学你好,效果是正确的,不过代码可以再优化一下,例如:

http://img.mukewang.com/climg/5f31230a095013f403360470.jpg

祝学习愉快~

0

0 学习 · 40143 问题

查看课程