zoukankan      html  css  js  c++  java
  • 浮动

    1、制作三角形

    <!DOCTYPE html>
    <html lang="en">
    <head>
        <meta charset="UTF-8">
        <title></title>
        <style>
            div{
                /*color: transparent;*/
                width: 0px;
                height: 0px;
                border-bottom: 20px solid red;
                border-left: 20px solid transparent;
                border-right: 20px solid transparent;
                
    
            }
        </style>
    </head>
    <body>
        <div>
            
    
        </div>
        
    </body>
    </html>

    2、制作圆

    <!DOCTYPE html>
    <html lang="en">
    <head>
        <meta charset="UTF-8">
        <title></title>
        <style>
            div{
                /*color: transparent;*/
                width: 200px;
                height: 200px;
                background-color: red;
                /*制作圆角*/
                /*border-radius: 3px;*/
                /*border-radius: 100px;*/
                border-radius: 50%;
                
                
    
            }
        </style>
    </head>
    <body>
        <div>
            
    
        </div>
        
    </body>
    </html>

    3、clear清除浮动

    <!DOCTYPE html>
    <html lang="en">
    <head>
        <meta charset="UTF-8">
        <title></title>
        <style>
        *{
            padding: 0;
            margin: 0;
        }
        .father{
            width: 500px;
            /*height: 400px;*/
    
        }
        .box1{
            width: 100px;
            height: 100px;
            background-color:red;
            float: left;
        }
        .box2{
            width: 100px;
            height: 300px;
            background-color:green;
            float: left;
        }
        .box3{
            width: 100px;
            height: 100px;
            background-color:blue;
            float: left;
        }
        .father2{
            width: 600px;
            height: 200px;
            background-color: yellow;
        }
        .clearfix{
            clear:both;
        }
        </style>
    </head>
    <body>
        
            <div class="father">
                <div class="box1">1</div>
                <div class="box2">2</div>
                <div class="box3">3</div>
                <!-- 内墙法 -->
                <div class="clearfix"></div>
    
    
            </div>
        
    
        <div class="father2"></div>
    
        
    </body>
    </html>

    4、伪元素清除法

    <!DOCTYPE html>
    <html lang="en">
    <head>
        <meta charset="UTF-8">
        <title></title>
        <link rel="shortcut icon" href="./ico" type="image/x-icon">
        <style>
    .clearfix:after {
        content: ".";
        display: block;
        height: 0;
        visibility: hidden;
        clear: both
    }
        </style>
    </head>
    <body>
        <!-- <p>
            <span>aaaaa</span>
        </p> -->
        <div class="box">
            <div class="father  clearfix">
                <div class="box1">1</div>
                <div class="box2">2</div>
                <div class="box3">3</div>
    
            </div>
        </div>
    
        <div class="father2"></div>
    
        
    </body>
    </html>

    5、overflow清除浮动

    <!DOCTYPE html>
    <html lang="en">
    <head>
        <meta charset="UTF-8">
        <title></title>
        <style>
        *{
            padding: 0;
            margin: 0;
        }
        .father{
            width: 500px;
            /*height: 400px;*/
            overflow: hidden;
    
        }
        .box1{
            width: 100px;
            height: 100px;
            background-color:red;
            float: left;
        }
        .box2{
            width: 100px;
            height: 300px;
            background-color:green;
            float: left;
        }
        .box3{
            width: 100px;
            height: 100px;
            background-color:blue;
            float: left;
        }
        .father2{
            width: 600px;
            height: 200px;
            background-color: yellow;
        }
        
    
        </style>
    </head>
    <body>
        <!-- <p>
            <span>aaaaa</span>
        </p> -->
        <div class="box">
            <div class="father">
                <div class="box1">1</div>
                <div class="box2">2</div>
                <div class="box3">3</div>
    
            </div>
        </div>
    
        <div class="father2"></div>
    
        
    </body>
    </html>

    6、iconfont用法

    <!DOCTYPE html>
    <html lang="en">
    <head>
        <meta charset="UTF-8">
        <title></title>
        <style>
            /*第一步:拷贝项目下面生成的font-face*/
            
            @font-face {font-family: 'iconfont';
                src: url('./font/iconfont.eot');
                src: url('./font/iconfont.eot?#iefix') format('embedded-opentype'),
                url('./font/iconfont.woff') format('woff'),
                url('./font/iconfont.ttf') format('truetype'),
                url('./font/iconfont.svg#iconfont') format('svg');
            }
    
            .iconfont{
                font-family:"iconfont" !important;
                font-size:16px;font-style:normal;
                -webkit-font-smoothing: antialiased;
                -webkit-text-stroke-width: 0.2px;
                -moz-osx-font-smoothing: grayscale;
            }
            .aa{
                font-size: 20px;
            }
            .tt{
                font-size: 26px;
            }
        </style>
    </head>
    <body>
        <i class="iconfont aa">&#xe600;</i>
        <span class="iconfont tt">&#xe618;</span>
        
    </body>
    </html>
  • 相关阅读:
    centos7/RHEL7安装LibreOffice
    CentOS7开机启动管理systemd简介及使用
    Vim使用技巧
    16_用LVM扩展xfs文件系统(当分区空间不够时)
    15_RHEL7挂载NTFS分区
    14_RHEL7安装mplayer
    polyfill-eventsource added missing EventSource to window ie浏览器 解决方案
    关于vue,webpack 中 “exports is not defined”报错
    2018 vue前端面试题
    Error: No PostCSS Config found in... 报错 踩坑记
  • 原文地址:https://www.cnblogs.com/P-Z-W/p/11261457.html
Copyright © 2011-2022 走看看