视频中的实现,可以使用“拔河效应”吗?

视频中的实现,可以使用“拔河效应”吗?

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">

   <head>
      <title>4-1-示例</title>
      <meta charset="UTF-8">
      <meta name="renderer" content="webkit">
      <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
      <style type="text/css">
            *
            {
                margin: 0;
                padding: 0;
            }

            html,
            body
            {
                width: 100%;
                height: 100%;
            }

            .content
            {
                width: 1920px;
                height: 4040px;
                background: url("../images/mooc.png") center no-repeat;
            }

            .opacity
            {
                position: fixed;
                left: 0;
                top: 0;
                width: 100%;
                height: 100%;
                background-image: url("../images/opacity.png");
            }

            .login
            {
                position: fixed;
                left: 0;
                right: 0;
                top: 0;
                bottom: 0;
                margin: auto;
                width: 360px;
                height: 360px;
                background: url("../images/login.png") no-repeat;
            }
        </style>
   </head>

   <body>
      <div class="content"></div>
      <div class="opacity"></div>
      <div class="login"></div>
   </body>

</html>

使用“拔河效应'的适应性更好,不需要计算负margin值。

正在回答 回答被采纳积分+1

登陆购买课程后可参与讨论,去登陆

1回答
好帮手慕糖 2019-06-11 10:25:32

同学你好,由于代码的灵活性,同一种效果实现的方式并不是唯一的,这里使用拔河效应也是没有问题的,不过还有一点建议:如下,大盒子的宽度建议:设置宽度100%哦,设置1920有的屏幕分辨率可能没有这么大,会导致出现滚动条哦。

http://img1.sycdn.imooc.com//climg/5cff10e60001e62e03200081.jpg

希望能帮助到你,欢迎采纳。

祝学习愉快!

问题已解决,确定采纳
还有疑问,暂不采纳

恭喜解决一个难题,获得1积分~

来为老师/同学的回答评分吧

0 星
请稍等 ...
微信客服

购课补贴
联系客服咨询优惠详情

帮助反馈 APP下载

慕课网APP
您的移动学习伙伴

公众号

扫描二维码
关注慕课网微信公众号

在线咨询

领取优惠

免费试听

领取大纲

扫描二维码,添加
你的专属老师