当前位置:网站首页>Understand the role of before and after Clearfixafter clear floating
Understand the role of before and after Clearfixafter clear floating
2022-06-11 02:05:00 【Bejpse】
The first style setting
When adding... To an element span, Want to set up css style , You need to rename it and set it again css style , To achieve the effect , More trouble
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title></title>
<style>
span:nth-of-type(1){
border: 1px solid red;
}
span:nth-of-type(2){
border: 1px solid salmon;
}
</style>
</head>
<body>
<p>
<span> Love :</span>
I love css
<span> Don't love </span>
</p>
</body>
</html>

The second style setting
We can find out , We can go straight to css with .pp:before( front ) Create an inline element
.pp:after( after ) Create an inline element
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title></title>
<style>
.pp:before{
content: " I :";
border: 1px red solid;
}
.pp::after{ content: " Don't love ";
border: 1px red solid;
}
</style>
</head>
<body>
<p class="pp">
I love css
</p>
</body>
</html>

.clearfix:after Clear the float
You must have seen and understood .
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title></title>
<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
<style>
div{
background-color: gold;
}
div p{ background-color: hotpink; float: left;}
.clearfix:after{
content: "";
display: block;
clear: both;
}
</style>
</head>
<body>
<div class="clearfix">
<p>abc</p>
<p>dev</p>
<p>good</p>
</div>
</body>
</html>

边栏推荐
- Is it correct to declare an array in this way? int n=10,a[n]; What if so? const int n =10; int a[n];
- 【音乐】基于matlab演奏《青花瓷》【含Matlab源码 1873期】
- [leetcode] a group of K flipped linked lists
- Alibaba cloud Tianchi online programming training camp_ Task arrangement
- [music] playing blue and white porcelain based on MATLAB [including Matlab source code 1873]
- Linux Installation MySQL database details
- 2021-2-26 compilation of programming language knowledge points
- flutter_swiper 轮播图 插件
- Task03: stack
- Introduction and practice of QT tcp/udp network protocol (supplementary)
猜你喜欢

Clip paper details

Sword finger offer II 095 Longest common subsequence dynamic programming

ABAP CDS实现多行字段内容拼接

【音乐】基于matlab演奏《青花瓷》【含Matlab源码 1873期】

QT widget's simple serial port assistant (qserialport)

Programming implementation: input any English month, and output its corresponding Chinese prompt after looking up the month table. Abbreviations can also be found.
![[leetcode] ordered linked list transformation binary search tree](/img/9f/86e819beb8dc678d79c3e307891402.jpg)
[leetcode] ordered linked list transformation binary search tree

MD61计划独立需求导入BAPI【按日维度/动态模板/动态字段】

Flutter status management

Complete tutorial on obtaining voltage from QGC ground station (APM voltage cannot be obtained from QGC)
随机推荐
Matlab digital operation function notes
【MATLAB】图像复原
Sparrowrecsys recurrence record
20N10-ASEMI中小功率MOS管20N10
Elsevier ---elseviewer--- preprint online publishing notice
Alibaba cloud Tianchi online programming training camp_ Task arrangement
Linux Installation MySQL database details
[leetcode] ordered linked list transformation binary search tree
Introduction and practice of QT tcp/udp network protocol (supplementary)
薪的测试开发程序员们,你为何要走?和产品相互残杀到天昏地暗......
【交通标志识别】基于matlab GUI YCbCr特征提取+BP神经网络交通标志识别【含Matlab源码 1869期】
[matlab] image segmentation
【音乐】基于matlab演奏《过火》【含Matlab源码 1875期】
Method of using dism command to backup driver in win11 system
[matlab] image transform (Fourier transform, discrete cosine transform)
Task04: String
Win11怎么更改管理员头像?Win11更换管理员头像的方法
Deep exploration of functions with indefinite parameters in C language
晚餐阿帮的手艺
Can the soft exam certificate be settled in Shanghai? Many people don't know