zoukankan      html  css  js  c++  java
  • html两大布局

    html布局之圣杯布局

    <!DOCTYPE html>
    <html lang="en">
    <head>
        <meta charset="UTF-8">
        <title>圣杯布局</title>
        <link href="buju1.css" type="text/css" rel="stylesheet"/>
    </head>
    <body>
    <<div class="container">
        <div class="main"></div>
        <div class="sub"></div>
        <div class="extra"></div>
    </div>
    </body>
    </html>

    CSS

    body {
        min-width: 600px; /* 2*sub + extra */
    }
    .container {
        padding-left: 210px;
        padding-right: 190px;
    }
    .main {
        float: left;
        width: 100%;
        height: 300px;
        background-color: rgba(255, 0, 0, .5);
    }
    .sub {
        position: relative;
        left: -210px;
        float: left;
        width: 200px;
        height: 300px;
        margin-left: -100%;
        background-color: rgba(0, 255, 0, .5);
    }
    .extra {
        position: relative;
        right: -190px;
        float: left;
        width: 180px;
        height: 300px;
        margin-left: -180px;
        background-color: rgba(0, 0, 255, .5);
    }

    样式布局之双飞翼布局

    <!DOCTYPE html>
    <html lang="en">
    <head>
        <meta charset="UTF-8">
        <title>双飞翼布局</title>
        <link href="buju.css" type="text/css" rel="stylesheet"/>
    </head>
    <body>
    <div class="main-wrapper">
        <div class="main"></div>
    </div>
    <div class="sub"></div>
    <div class="extra"></div>
    </body>
    </html>

    css

    .main-wrapper {
        float: left;
        width: 100%;
    }
    .main {
        height: 300px;
        margin-left: 210px;
        margin-right: 190px;
        background-color: rgba(255, 0, 0, .5);
    }
    .sub {
        float: left;
        width: 200px;
        height: 300px;
        margin-left: -100%;//这个地方要注意了margin-left设置为负值得话,位置往左移动,当移出这一行时,就会跑到上一行去,然后继续往左移动,如果margin-left设置为正值的话,位置就会往右移动,并且会一直往右动,并不会跳到下一行去。
        background-color: rgba(0, 255, 0, .5);
    }
    .extra {
        float: left;
        width: 180px;
        height: 300px;
        margin-left: -180px;
        background-color: rgba(0, 0, 255, .5);
    }
  • 相关阅读:
    解释 ASP.NET中的Web页面与其隐藏类之间的关系
    B/S与C/S的联系与区别
    三层架构
    列举 ASP.NET页面之间传递值的几种方式
    什么是SQL注入式攻击?如何防范?
    post、get的区别
    Session,ViewState,Application,cookie的区别?
    Vue 09.前后端交互
    Vue 08.webpack中使用.vue组件
    Vue 07.webpack
  • 原文地址:https://www.cnblogs.com/yuaima/p/5875045.html
Copyright © 2011-2022 走看看