Blog
首页
文档
收藏
关于
  • 在线转换时间戳 (opens new window)
  • 在线压缩图片 (opens new window)
  • Float-Double转二进制 (opens new window)
  • 文件转Hex字符串 (opens new window)

HiuZing

🍑
首页
文档
收藏
关于
  • 在线转换时间戳 (opens new window)
  • 在线压缩图片 (opens new window)
  • Float-Double转二进制 (opens new window)
  • 文件转Hex字符串 (opens new window)
  • 前端面试题

  • JavaScript

  • Vue2

  • port

  • CSS

    • flex

    • Scss

    • CSS常见问题

      • CSS行内块之间的缝隙
      • CSS命名规范
      • CSS实现单行、多行文本溢出隐藏
      • CSS工具
      • CSS宽高比
      • CSS图片之间的缝隙
      • CSS渐变边框
      • CSS样式-动态绑定
      • CSS样式穿透
      • CSS实现两栏布局
      • CSS实现三栏布局
        • CSS实现三栏布局
          • 利用绝对定位
          • 利用flex布局
      • CSS实现双飞翼(圣杯)布局
      • CSS实现水平垂直居中
      • CSS-BFC
      • CSS-Position
      • CSS-定义使用变量
      • CSS-display
      • CSS-盒模型
      • transform
      • Animate.css
    • less

  • Node.js

  • JavaScript优化

  • uniapp

  • Mini Program

  • TypeScript

  • 面向对象编程

  • UI组件

  • Plugin

  • Vue3

  • 性能优化

  • Axios

  • 状态管理

  • React

  • Mock

  • Icon

  • Template

  • 构建工具

  • 项目规范配置

  • Taro

  • SVG

  • React Native

  • 前端
  • CSS
  • CSS常见问题
HiuZing
2022-11-09
目录

CSS实现三栏布局

# CSS实现三栏布局

三栏布局一般指的是页面中一共有三栏,左右两栏宽度固定,中间自适应的布局

# 利用绝对定位

左右两栏设置为绝对定位,中间设置对应方向大小的margin的值

.outer {
  position: relative;
  height: 100px;
}

.left {
  position: absolute;
  width: 100px;
  height: 100px;
  background: tomato;
}

.right {
  position: absolute;
  top: 0;
  right: 0;
  width: 200px;
  height: 100px;
  background: gold;
}

.center {
  margin-left: 100px;
  margin-right: 200px;
  height: 100px;
  background: lightgreen;
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27

# 利用flex布局

左右两栏设置固定大小,中间一栏设置为flex:1

.outer {
  display: flex;
  height: 100px;
}

.left {
  width: 100px;
  background: tomato;
}

.right {
  width: 100px;
  background: gold;
}

.center {
  flex: 1;
  background: lightgreen;
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
上次更新: 2024/08/14, 04:14:33
CSS实现两栏布局
CSS实现双飞翼(圣杯)布局

← CSS实现两栏布局 CSS实现双飞翼(圣杯)布局→

最近更新
01
React Native 使用SVG
08-13
02
Docker基础命令
08-04
03
算数逻辑单元
07-30
更多文章>
Theme by Vdoing | Copyright © 2021-2024 WeiXiaojing | 友情链接
  • 跟随系统
  • 浅色模式
  • 深色模式
  • 阅读模式