老师,这样做对吗?
来源:4-3 编程练习
qq_慕前端5127026
2019-10-28 23:09:22
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Document</title>
<style type="text/css">
.container{width:1903px;height:4043px;
background: url("http://climg.mukewang.com/59c9f7ce0001839219034033.png") center top;}
.web{width:224px;height:364px;background-image: url("http://climg.mukewang.com/5a3383c70001f1b702240364.png");position:fixed;top:50%;left:0;margin-top: -192px;}
.java{width:224px;height:364px;background-image:url("http://climg.mukewang.com/5a3383d00001a3dd02240364.png");position:fixed;top:50%;right:0;margin-top: -192px;}
</style>
</head>
<body>
<div class="container">
<div class="web"></div>
<div class="java"></div>
</div>
</body>
</html>
1回答
好帮手慕糖
2019-10-29
同学你好,1、水平方向出现滚动条,建议:可以设置宽度100%。例:

2、左右两个区别,高度是364px,margin-top为高度的负的一半。一半的话应该是182,所以应该是-182px哦。例:如下,右侧的也可以参考修改下。

希望能帮助到你,欢迎采纳。
祝学习愉快!
相似问题