老师,这样是否垂直居中了??

来源:4-3 编程练习

优秀的人需要努力

2019-07-12 17:26:53

<html>

<head>

    <meta charset="UTF-8">

<title></title>

<style>

   *{

       margin:0;

       padding:0;

   }

   .con{

       width:100%;

       height:100%;

       

   }

   

   .d{

    background-position: center;

    background-repeat: no-repeat;

    }

   

   

   .d1 img {

    width:200px;

    height: 360px;

            position:fixed;

       left:0;

       top:50%;

       margin-top:-180px ;

      

   }

   

   .d2 img {

    width:200px;

    height: 360px;

            position:fixed;

       right:0;

       top:50%;

       margin-top:-180px ;

      

   }

</style>

</head>

<body>

    

    <div class="con">

        <div class="d">

         <img  src="http://climg.mukewang.com/59c9f7ce0001839219034033.png"/>

         

        </div>

        

        <div class="d1">

            <img src="http://climg.mukewang.com/5a3383c70001f1b702240364.png"/> 

        </div>

        

        <div class="d2">

            <img src="http://climg.mukewang.com/5a3383d00001a3dd02240364.png"/>  

        </div>

    </div>


</body>

</html>


写回答

1回答

好帮手慕言

2019-07-12

同学你好,实现垂直居中了,效果完整的很棒,继续加油,祝学习愉快~

0

0 学习 · 40143 问题

查看课程