老师,这样写对吗?

来源:4-3 编程练习

Redamancy_Y6

2019-11-21 21:46:48

<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>em</title>
    <style>
    *{
        margin:0;
        padding:0;
    }
        .tu1{
            position:fixed;
           left:0;
           top:50%;
           width: 220px;
           height:364px;
           margin-top:-182px; 
        }
        .tu2{
            position:fixed;
            right:0;
            top:50%;
            width: 220px;
           height:364px;
            margin-top:-182px;
        }
    </style>
</head>
<body>
    <div class="bj">
        <img src="http://img1.sycdn.imooc.com\/climg/59c9f7ce0001839219034033.png">
    </div>
    <div class="tu1">
        <img src="http://img1.sycdn.imooc.com\/climg/5a3383c70001f1b702240364.png">
    </div>
    <div class="tu2">
        <img src="http://img1.sycdn.imooc.com\/climg/5a3383d00001a3dd02240364.png">
    </div>
</body>
</html>


写回答

1回答

好帮手慕糖

2019-11-22

同学你好,代码是正确的。但是还可以再优化下。

若是有的设备分辨率小的话,水平方向可能会出现滚动条(大图片太大导致),建议:可以给bj的img设置下宽度100%,例:

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

如果我的回答帮助了你,欢迎采纳,祝学习愉快~

0
hedamancy_Y6
h 这样呀,谢谢老师!
h019-11-22
共1条回复

0 学习 · 40143 问题

查看课程