代码正确么?
来源: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回答
同学你好,代码实现的是正确的,但是还可以优化下,将元素的默认样式去掉:
如果我的回答帮助了你,欢迎采纳。祝学习愉快~
相似问题