当前位置:网站首页>使用定位实现左中右布局,中间内容自适应
使用定位实现左中右布局,中间内容自适应
2022-07-26 10:38:00 【songywaa】
定位有俩种方式:
1、左右使用定位,中间正常;
2、左中右都使用定位;
第一种方法:(注意div.center的位置)
.box{
position: relative;
}
.left{
position:absolute;
left: 0;
width:200px;
}
.right{
position:absolute;
right: 0;
width:200px;
}
.center{
padding:0 200px;
}
<div class="box">
<div class="left">我是左边</div>
<div class="right">我是右边</div>
<div class="center">我是中间</div>
<!--注意center的位置,!!!!放到最后,因为定位脱离文档流不占高度-->
</div>
第二种方法
.box{
position: relative;
}
.left{
position:absolute;
left: 0;
width:200px;
}
.right{
position:absolute;
right: 0;
width:200px;
}
.center{
position: absolute;
left: 200px;
right:200px;
}
<div class="box">
<div class="left">我是左边</div>
<div class="center">我是中间</div>
<div class="right">我是右边</div>
</div>
边栏推荐
- A semicolon is missing
- Datav beautiful data screen production experience
- [leetcode每日一题2021/2/14]765. 情侣牵手
- 鹏哥C语言——扫雷2021-08-16
- MD5 encryption
- 在神州IV开发板上为STemWin 5.22加入触屏驱动
- MLX90640 红外热成像仪测温传感器模块开发笔记(六)红外图像伪彩色编码
- Okaleido ecological core equity Oka, all in fusion mining mode
- [leetcode每日一题2021/5/8]1723. 完成所有工作的最短时间
- Inheritance method of simplified constructor (I) - combined inheritance
猜你喜欢

hx711 数据波动大的问题

RT-Thread 学习笔记(五)---编辑、下载、调试程序

【机器学习小记】【人脸识别】deeplearning.ai course4 4th week programming

在神州IV开发板上成功移植STemWin V5.22

第5期:大学生入职必备技能之二

Issue 5: the second essential skill for College Students

【机器学习小记】【风格迁移】deeplearning.ai course4 4th week programming(tensorflow2)

2021-08-12函数递归_和鹏哥学习C语言

在altium designer中禁用USBJATG

Introduction to data analysis | kaggle Titanic mission (I) - > data loading and preliminary observation
随机推荐
.net operation redis string string
Simple use of json-c Library -- converting JSON files to struct
Introduction to data analysis | kaggle Titanic mission
多目标优化系列1---NSGA2的非支配排序函数的讲解
Redis implementation of distributed lock solution
.NET操作Redis Set无序集合
第5期:大学生入职必备技能之二
Analysis of the transaction problem of chained method call
剑指Offer(五十三):表示数值的字符串
卸载魅族应用商店
[leetcode每日一题2021/2/18]【详解】995. K 连续位的最小翻转次数
L2-005 set similarity (intersection of vector and set)
[leetcode每日一题2021/8/30]528. 按权重随机选择【中等】
IAR sprintf 浮点 在UCOS 总格式化成0.0的问题
RT-Thread 学习笔记(八)---开启基于SPI Flash的elmfat文件系统(下)
Application of.Net open source framework in industrial production
el-table实现可编辑表格
文案秘籍七步曲至----文献团队协作管理
[notes on machine learning] [building a cyclic neural network and its application] deeplearning ai course5 1st week programming(keras)
Oracle cannot start tnslistener service cannot start