当前位置:网站首页>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
边栏推荐
- 无代码六月大事件|2022无代码探索者大会即将召开;AI增强型无代码工具推出...
- 59. Spiral matrix
- [SQL Server fast track] - authentication and establishment and management of user accounts
- 类和对象(一)this指针详解
- 03. 开发博客项目之登录
- 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
- [detailed explanation of Huawei machine test] statistics of shooting competition results
- 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
- Sequoiadb Lake warehouse integrated distributed database, June 2022 issue
- 初识数据库
猜你喜欢
Pix2pix: image to image conversion using conditional countermeasure networks
The digital economy has broken through the waves. Is Ltd a Web3.0 website with independent rights and interests?
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
Codeless June event 2022 codeless Explorer conference will be held soon; AI enhanced codeless tool launched
Vulhub vulnerability recurrence 73_ Webmin
Yygh-11-timing statistics
Summary of deep learning tuning tricks
B站刘二大人-数据集及数据加载 Lecture 8
29io stream, byte output stream continue write line feed
数字经济破浪而来 ,LTD是权益独立的Web3.0网站?
随机推荐
First acquaintance with CDN
Figure database ongdb release v-1.0.3
02. 开发博客项目之数据存储
What impact will frequent job hopping have on your career?
移植InfoNES到STM32
【经验】win11上安装visio
01. Project introduction of blog development project
01. 开发博客项目之项目介绍
Analysis of grammar elements in turtle Library
Check the useful photo lossless magnification software on Apple computer
指针经典笔试题
P2802 回家
Vulhub vulnerability recurrence 72_ uWSGI
Promotion hung up! The leader said it wasn't my poor skills
【torch】|torch.nn.utils.clip_grad_norm_
Unity Vector3. Use and calculation principle of reflect
PDK工藝庫安裝-CSMC
HAC cluster modifying administrator user password
YYGH-11-定时统计
How to use PHP string query function