当前位置:网站首页>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
边栏推荐
- After the project is released, index Html is cached
- Promotion hung up! The leader said it wasn't my poor skills
- ARTS Week 25
- 04. Project blog log
- 【torch】|torch. nn. utils. clip_ grad_ norm_
- 05. 博客项目之安全
- AUTOSAR从入门到精通番外篇(十)-嵌入式S19文件解析
- 应用安全系列之三十七:日志注入
- [email protected]树莓派
- Installation de la Bibliothèque de processus PDK - csmc
猜你喜欢
Codeforces Round #804 (Div. 2) Editorial(A-B)
嵌入式面试题(四、常见算法)
SQLite add index
[SQL Server Express Way] - authentification et création et gestion de comptes utilisateurs
Summary of deep learning tuning tricks
实践分享:如何安全快速地从 Centos迁移到openEuler
大型网站如何选择比较好的云主机服务商?
01. Project introduction of blog development project
[force buckle]43 String multiplication
04. Project blog log
随机推荐
Vulhub vulnerability recurrence 69_ Tiki Wiki
P2802 回家
Redis message queue
Self built DNS server, the client opens the web page slowly, the solution
Improve jpopup to realize dynamic control disable
2022半年总结
[detailed explanation of Huawei machine test] statistics of shooting competition results
指针经典笔试题
Codeforces Round #804 (Div. 2) Editorial(A-B)
初识CDN
算法-- 爬楼梯(Kotlin)
【经验】win11上安装visio
【云原生】3.1 Kubernetes平台安装KubeSpher
Jvxetable implant j-popup with slot
Game push image / table /cv/nlp, multi-threaded start
How to use PHP string query function
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
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站刘二大人-线性回归 Pytorch
UCF(2022暑期团队赛一)