帮忙看一下正确吗?

来源:7-2 编程练习

慕先生3246696

2019-07-26 16:15:19

<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title></title>
    <style type="text/css">
    .div1{
        width:1500px;
    height: 2000px;
     position: relative;
    }
    .div2{
        position: fixed;
            top:50%;
            width: 50px;
            height: 200px;
    }
    .div3{
         position: fixed;
            top: 50%;
            width: 50px;
            height: 200px;
            right: 150px;
    }
</head>
<body>
    <div class="div1" src="http://climg.mukewang.com/59c9f7ce0001839219034033.png" >
<div class="div2">
<img class="img2" src="http://climg.mukewang.com/5a3383c70001f1b702240364.png">
</div>
<div class="div3">
<img class="img3" src="http://climg.mukewang.com/5a3383d00001a3dd02240364.png">
</div>
</div>
</body>
</html>

写回答

1回答

好帮手慕小尤

2019-07-26

同学你好,1、缺少style结束标签。2、div中是无法引入图片的,img标签才可以引入图片。代码进行修改,如下:

<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title></title>
    <style type="text/css">
    .div1{
        width:1500px;
    	height: 2000px;
     	position: relative;
    }
    .div2{
        position: fixed;
        top:50%;
        width: 50px;
        height: 200px;
        margin-top:-180px;
    }
    .div3{
        position: fixed;
        top: 50%;
        width: 50px;
        height: 200px;
        right: 150px;
        margin-top:-180px;
    }
</style>
</head>
<body>
    <div class="div1">
    	<img src="http://climg.mukewang.com/59c9f7ce0001839219034033.png" alt="">
	<div class="div2">
		<img class="img2" src="http://climg.mukewang.com/5a3383c70001f1b702240364.png">
	</div>
	<div class="div3">
		<img class="img3" src="http://climg.mukewang.com/5a3383d00001a3dd02240364.png">
	</div>
</div>
</body>
</html>

祝学习愉快!

0

0 学习 · 4928 问题

查看课程