代码正确么?

来源:4-3 编程练习

青旗

2020-05-26 18:19:45

<!DOCTYPE html>

<html>

<head>

    <meta charset="UTF-8">

<title></title>

<style>

   .main{

       width:100%;

       height:1000px;

       background:url(http://climg.mukewang.com/59c9f7ce0001839219034033.png); top:0; left:0 no-repeat;

   }

   .one{

       width:200px;

       height:240px;

       background:url(http://climg.mukewang.com/5a3383c70001f1b702240364.png);

       position:fixed;

       top:50%;

       margin-top:-120px;

   }

   .two{

       width:200px;

       height:240px;

       background:url(http://climg.mukewang.com/5a3383d00001a3dd02240364.png);

       position:fixed;

       top:50%;

       right:0;

       margin-top:-120px;

   }

</style>

</head>

<body>

<div class="main">

   <div class="one"></div>

   <div class="two"></div>

</div>

</body>

</html>


写回答

1回答

好帮手慕粉

2020-05-26

同学你好,代码实现的是正确的,但是还可以优化下,将元素的默认样式去掉:

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

如果我的回答帮助了你,欢迎采纳。祝学习愉快~

0

0 学习 · 40143 问题

查看课程