裂开的咸鱼 2022-01-30 09:04 采纳率: 88.9%
浏览 59
已结题

html中盒子没有置顶

   <style>
        html {
            background-color: blue;
        }
        
        .box1 {
            width: 1040px;
            top: 0px;
            height: 10000px;
            background-color: rgb(255, 0, 0);
            /* 居中盒子两个条件,有宽度,左右外对齐为auto值 */
            margin: 0 auto;
        }
        
        .vertical {
            width: 50px;
            height: 10000px;
            background-color: black;
            margin-left: 80%;
            z-index: 10;
        }
        
        .line {
            position: fixed;
            left: auto;
            right: auto;
            bottom: 20%;
            width: 1040px;
            height: 50px;
            background-color: rgb(229, 255, 0);
            z-index: 8;
        }
        
        .bottombox {
            position: fixed;
            left: auto;
            right: auto;
            bottom: 0%;
            width: 800px;
            height: 150px;
            background-color: rgb(9, 255, 243);
            z-index: 10;
        }
    </style>
</head>

<body>
    <div class="box1">
        <div class="vertical"></div>
        <div class="line"></div>
        <div class="bottombox"></div>
    </div>
</body>

</html>


![img](https://img-mid.csdnimg.cn/release/static/image/mid/ask/630336405346132.png "#left")
  • 写回答

3条回答 默认 最新

  • chuifengde 2022-01-30 09:46
    关注

    style中加一行 body {
    margin-top: 0px;
    }

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(2条)

报告相同问题?

问题事件

  • 系统已结题 2月7日
  • 已采纳回答 1月30日
  • 创建了问题 1月30日

悬赏问题

  • ¥50 三种调度算法报错 有实例
  • ¥15 关于#python#的问题,请各位专家解答!
  • ¥200 询问:python实现大地主题正反算的程序设计,有偿
  • ¥15 smptlib使用465端口发送邮件失败
  • ¥200 总是报错,能帮助用python实现程序实现高斯正反算吗?有偿
  • ¥15 对于squad数据集的基于bert模型的微调
  • ¥15 为什么我运行这个网络会出现以下报错?CRNN神经网络
  • ¥20 steam下载游戏占用内存
  • ¥15 CST保存项目时失败
  • ¥20 java在应用程序里获取不到扬声器设备