美文网首页
css左右布局+上下布局

css左右布局+上下布局

作者: 牙牙and小尾巴 | 来源:发表于2019-06-26 09:51 被阅读0次
<!DOCTYPE html>
<html lang="zh-CN">

<head>
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
    <meta charset="utf-8" />
    <title></title>

    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0" />

    <style>
    
    /*方式一 float+margin
    .all{
      height:500px
    }
    .left{
      float:left;
      width:200px;
      background-color:red;
      height:100%;
    }
    .right{
       width:100%;
       height:100%;
       margin-left:200px;
       background-color:yellow;
    }
    */
    /*方式二 float+overflow:hidden
    .all{
      height:500px
    }
    .left{
      float:left;
      width:200px;
      background-color:red;
      height:100%;
    }
    .right{
       overflow:hidden;
       height:100%;
       background-color:yellow;
    }
    */
    /*方式三  flex */
    .all{
      height:500px;
      display:flex;
    }
    .left{
      width:200px;
      background-color:red;
      height:100%;
    }
    .right{
       flex:1;
       height:100%;
       background-color:yellow;
       display: flex; //为了后面的上下布局
       flex-direction: column; //为了后面的上下布局
    }
    .top{
      height: 100px;
      background-color: blue;
    }
    .bottom{
      flex: 1;
      background-color: black;
    }
    
    /*方式四  绝对定位absolute 
    .all{
      height:500px;
      position: relative;
    }
    .left{
      width:200px;
      background-color:red;
      height:100%;
    }
    .right{
      position:absolute;
      left: 200px;
      top: 0px;
      bottom: 0px;
      right: 0px;
      background-color: yellow;
    }
    .top{
      height: 100px;
      background-color: blue;
    }
    .bottom{
      position: absolute;
      background-color: black;
      top: 100px;
      bottom: 0px;
      left: 0px;
      right: 0px;
    }*/
    </style>
    
</head>

<body>
    <div  class="all">
      <div class="left"></div>
      <div class="right">
       <div class="top">
       </div>
       <div class="bottom">
       </div>
      </div>
    </div>
     
</body>
<script>

</script>

</html>

相关文章

  • css左右布局+上下布局

  • 前端面试知识点

    css 盒模型 布局 左右布局 上下布局 display position nodejs 文件 流 express...

  • html编程技巧

    字体外部描边 Css 基于flex布局的盒子上下居中 Css 基于flex布局的盒子左右居中 Css 基于flex...

  • css布局和居中

    本文主要介绍了css常用的布局,居中等其他小技巧。 css布局 左右布局 利用float实现左右布局 左右模块设置...

  • css布局

    最近在学习css相关的知识,本文主要总结一些css布局相关的知识。 一、左右布局和左中右布局 左右布局和左中右布局...

  • CSS的布局与居中

    css的布局 css左右布局 双浮动|左右布局: 双浮动: 在子元素下面添加float,在父元素上面加上clear...

  • CSS布局技巧

    最近学习了CSS的一些知识,下面总结一下我学到的CSS布局技巧 1.左右布局 (1). 浮动左右布局也叫横向布局,...

  • 浅析 CSS 布局与定位

    浅析 CSS 布局与定位 较多内容参考:CSS布局与定位入门 一、左右布局 float + clearfix块级元...

  • CSS基本布局整理

    前言 css布局是前端开发必须掌握的基本内容,前端学习之css基本布局整理。 基本布局 左右布局 div结构: f...

  • 2019-04-04

    关于如何使用css布局 左右布局 在页面开发过程中要对页面进行左右布局排版,如何使用css的相关知识来做到呢? 以...

网友评论

      本文标题:css左右布局+上下布局

      本文链接:https://www.haomeiwen.com/subject/cseqcctx.html