你看有什么问题没有?大图怎么居中呢?我设置3个并列的DIV,为什么两个小图都跑下面去了

来源:7-2 编程练习

慕侠7348613

2019-08-08 10:32:28

<!DOCTYPE html>
<html lang="en">
<head>
   <meta charset="UTF-8">
   <title>Document</title>
   <style type="text/css">
       #a{margin-top: 20px;margin-left: 17%;}
       #b{position: fixed;top: 400px}
       #c{position: fixed;left: 400px;top: 400px}

   </style>
</head>
<body>
<div>
   <img id="a" src="大.jpg";>
   <img id="b" src="1.jpg";>
   <img id="c" src="2.jpg";>
</div>
</body>
</html>

写回答

1回答

好帮手慕小尤

2019-08-08

同学你好,因为id为a的图片设置了间距,导致图片,进行居中,因为大图过大,导致小图跑到了下面,同学可以将id为a的图片设置宽度将其并列显示。调整代码:

<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>Document</title>
    <style type="text/css">
        div{
            width: 100%;
        }
        #a{
            width: 100%;
            /*margin-top: 20px;*/
            /*margin-left: 17%;*/
        }
        #b{
            position: fixed;
            top: 400px
        }
        #c{
            position: fixed;
            right: 0;
            top: 400px
        }

    </style>
</head>
<body>
<div>
    <img id="a" src="http://climg.mukewang.com/59c9f7ce0001839219034033.png">
    <img id="b" src="http://climg.mukewang.com/5a3383c70001f1b702240364.png">
    <img id="c" src="http://climg.mukewang.com/5a3383d00001a3dd02240364.png">
</div>
</body>
</html>

祝学习愉快!

0

0 学习 · 4928 问题

查看课程