老师请看一下我这样写对吗?

来源:7-2 编程练习

一心励志当码农

2019-09-25 11:21:27

<!DOCTYPE html>
<html>
<head>
  <title></title>
  <link rel="stylesheet" type="text/css" href="index.css">
</head>
<body>
  <div class="div0">
      <div class="div1">
        <img class="img1" src="http://climg.mukewang.com/5a3383d00001a3dd02240364.png">
      </div>
      <div class="div2">
        <img class="img2" src="http://climg.mukewang.com/5a3383c70001f1b702240364.png">
      </div>
  </div>
</body>
</html>

.div0{
	height:4000px;
	background-size: 100%;
	background-image: url(http://climg.mukewang.com/59c9f7ce0001839219034033.png);
	background-repeat: no-repeat;
}
.img1{
	float:left;
	position: fixed;
	top:25%;
	width: 200px;
	height: 350px;
}
.img2{
	float:right;
	position: fixed;
	top:25%;
	right: 0px;
	width: 200px;
	height: 350px;
}


写回答

1回答

好帮手慕小班

2019-09-25

同学你好,运行贴出代码,实现效果是正确的呐,

但是根据题目要求,使得对联左右块元素相对于窗口垂直居中--> 同学这里没有使广告栏垂直居中哦,建议同学设置top:50%,margin-top为高度一半的负值来进行居中,比如:

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

如果我的回答解决了你的疑惑,请采纳,祝学习愉快~

0

0 学习 · 9666 问题

查看课程