当前位置:网站首页>Clear floating mode
Clear floating mode
2022-07-06 05:42:00 【Lei Haoming】
problem
html:
<div class="f-box">
<div class="box1"></div>
<div class="box2"></div>
</div>
css:
.f-box {
background-color: pink;
}
.box1, .box2 {
width: 200px;
height: 200px;
}
.box1 {
float: left;
background: tomato;
}
.box2 {
float: left;
background: greenyellow;
}
effect :
The parent element is not opened , So it doesn't show up .
terms of settlement
One 、 Add an empty tag
Add an empty label at the end of the element and set the style clear: both
html:
<div class="f-box">
<div class="box1"></div>
<div class="box2"></div>
<div style="clear: both"></div>
</div>
Two 、 Set the parent element to BFC
Set the parent element style overflow: hidden;
perhaps display: flex;
wait . establish BFC
.f-box {
background-color: pink;
overflow: hidden;
}
3、 ... and 、 Use pseudo elements
Set parent element after
Pseudo-element clears the float
In fact, this method is similar to the first one , Just use as element instead of empty tag
.f-box::after{
content:'';
display:block;
height:0;
clear:both;
visibility:hidden;
}
After the solution
边栏推荐
- 初识CDN
- The ECU of 21 Audi q5l 45tfsi brushes is upgraded to master special adjustment, and the horsepower is safely and stably increased to 305 horsepower
- B站刘二大人-多元逻辑回归 Lecture 7
- 【torch】|torch.nn.utils.clip_grad_norm_
- 【SQL server速成之路】——身份驗證及建立和管理用戶賬戶
- Game push image / table /cv/nlp, multi-threaded start
- Deep learning -yolov5 introduction to actual combat click data set training
- The ECU of 21 Audi q5l 45tfsi brushes is upgraded to master special adjustment, and the horsepower is safely and stably increased to 305 horsepower
- Processes and threads
- Unity gets the width and height of Sprite
猜你喜欢
What impact will frequent job hopping have on your career?
注释、接续、转义等符号
Migrate Infones to stm32
The ECU of 21 Audi q5l 45tfsi brushes is upgraded to master special adjustment, and the horsepower is safely and stably increased to 305 horsepower
RustDesk 搭建一个自己的远程桌面中继服务器
Redis消息队列
The ECU of 21 Audi q5l 45tfsi brushes is upgraded to master special adjustment, and the horsepower is safely and stably increased to 305 horsepower
初识数据库
Graduation design game mall
无代码六月大事件|2022无代码探索者大会即将召开;AI增强型无代码工具推出...
随机推荐
02. 开发博客项目之数据存储
Sword finger offer II 039 Maximum rectangular area of histogram
[force buckle]43 String multiplication
Analysis of grammar elements in turtle Library
Unity gets the width and height of Sprite
What impact will frequent job hopping have on your career?
(column 22) typical column questions of C language: delete the specified letters in the string.
JS array list actual use summary
AUTOSAR从入门到精通番外篇(十)-嵌入式S19文件解析
B站刘二大人-Softmx分类器及MNIST实现-Lecture 9
类和对象(一)this指针详解
[QNX hypervisor 2.2 user manual]6.3.3 using shared memory (shmem) virtual devices
Promotion hung up! The leader said it wasn't my poor skills
02. Develop data storage of blog project
The ECU of 21 Audi q5l 45tfsi brushes is upgraded to master special adjustment, and the horsepower is safely and stably increased to 305 horsepower
Vulhub vulnerability recurrence 72_ uWSGI
什么是独立IP,独立IP主机怎么样?
Text classification still stays at Bert? The dual contrast learning framework is too strong
Codeforces Round #804 (Div. 2) Editorial(A-B)
Application Security Series 37: log injection