zoukankan      html  css  js  c++  java
  • CSS补充

    <!--<!DOCTYPE html>-->
    <html lang="en">
    <head>
        <meta charset="UTF-8">
        <title>Title</title>
    </head>
    <body>
        <div onclick="Gotop();" style=" 50px;height: 50px;background-color: black;color: white;position: fixed
        ;bottom: 20px;
        right: 20px;
        ">返回顶部</div>
        <div style="height: 5000px;background-color: #dddddd">safsafas</div>
        <script>
            function Gotop() {
                document.body.scrollTop =0;
                // document.documentElement.scrollTop = 0;
            }
        </script>
    
    </body>
    </html>
    点返回到头部

    要注掉<!--<!DOCTYPE html>-->;document.body.scrollTop =0;才生效。否则使用 document.documentElement.scrollTop = 0;

    <!DOCTYPE html>
    <html lang="en">
    <head>
        <meta charset="UTF-8">
        <title>Title</title>
    </head>
    <body>
        <div style="position: relative; 700px;height: 200px;border: 1px solid red;margin: 0 auto">
            <div style="position: absolute;left: 0;bottom: 0; 50px;height: 50px;background-color: black"></div>
        </div>
        <div style="position: relative; 700px;height: 200px;border: 1px solid red;margin: 0 auto">
            <div style="position: absolute; 50px;height: 50px;background-color: #4371A6;right: 0;top: 0"></div>
        </div>
    
        <div style="position: relative; 700px;height: 200px;border: 1px solid red;margin: 0 auto">
            <div style="position: absolute; 50px;height: 50px;background-color: #9932CC;left: 0;bottom: 0"></div>
        </div>
    
    </body>
    </html>
    relative + absolute使用

    position:
                        fixed  固定在浏览器某个位置
                        absolute 紧跟滑轮滑动。

          relative +absolute absolute和relative联合使用

    <!DOCTYPE html>
    <html lang="en">
    <head>
        <meta charset="UTF-8">
        <title>Title</title>
        <style>
            .pg-header{
                background-color: #4371A6;
                height: 48px;
                position: fixed;
                color: #FF7F24;
                top: 0;
                left: 0;
                right: 0;
            }
            .pg-body{
                background-color: lightgray;
                height: 5000px;
                margin-top: 90px;
                width: 100%;
            }
        </style>
    </head>
    <body>
        <div class="pg-header">头部</div>
        <div class="pg-body">内容</div>
    
    </body>
    </html>
    固定头部,滑动滚动条依然显示
    <!DOCTYPE html>
    <html lang="en">
    <head>
        <meta charset="UTF-8">
        <title>Title4</title>
    </head>
    <body>
            <div style="z-index: 10;height: 400px; 500px;position: fixed;background-color: white;top: 50%;left: 50%;margin-left: -250px
                ;margin-top: -200px">
                <input type="text">
                <input type="text">
                <input type="text">
            </div>
            <div style="z-index: 9;osition: fixed;background-color: black;
                top: 0;
                left: 0;
                right: 0;
                bottom: 0;
                opacity: 0.5;
    
            "></div>
            <div style="height: 5000px;background-color: olivedrab">safsafas</div>
    </body>
    </html>
    透明度和层级操作优先级

                    opcity:0.5 透明度
                    z-index:层级操作优先级

    <!DOCTYPE html>
    <html lang="en">
    <head>
        <meta charset="UTF-8">
        <title>Title</title>
    </head>
    <body>
        <div style="height: 200px; 300px;overflow: auto">
            <img src="../14/html/1.jpg" >
        </div>
    
    </body>
    </html>
    当image大于div标签大小。overflow使用

    overflow:hidden  超过部分隐藏
                     auto    超过部分出现滚动条

  • 相关阅读:
    局域网组网总目录
    VLAN之间的通信
    DHCP
    ACL
    linux 程序后台运行
    VLAN
    VTP
    dubbox生产者与消费者案例
    String data jpa执行的增删改查
    StringBoot整合Mytais实现数据查询与分页
  • 原文地址:https://www.cnblogs.com/anhao-world/p/14079256.html
Copyright © 2011-2022 走看看