当前位置:网站首页>Simple understanding of pseudo elements before and after
Simple understanding of pseudo elements before and after
2022-06-11 06:01:00 【Not bald】
Pseudo elements before,after A simple understanding of
1.before,after brief introduction
Both are based on display:inline-block( Horizontal block level arrangement ) Attribute of exists ,::before Is to add content before the original element ,::after Is to add content after the original element , At the same time, the pseudo element also inherits the attributes of the original element , Just like if the original text is black , The text of pseudo elements will also be black .
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title></title>
<style type="text/css">
div::before{
content: " A piece of writing ";
}
</style>
</head>
<body>
<div style="color: #55FFFF;">
</div>
</body>
</html>

2.content attribute
content Properties can be written in , Like text , Symbol , Of course, you can not write .
1) written words
As the example in the introduction .
2) Symbol
<div>
<q> I am a text I am a text I am a text </q>
</div>
div::before{
width: 200px;
height: 200px;
background-color: #87CEEB;
content: open-quote;
}
div::after{
content: close-quote;
}
q{
quotes: '<''>';
}

3. And hover combination
And hover There will also be some good-looking effects after the combination .
.one{
width: 500px;
height: 200px;
background-color: #7FFFD4;
margin: 0 auto;
}
.one::after {
content: '';
position: absolute;
left: 0;
top: 0;
bottom: 0;
right: 0;
transition: .3s;
background: #ffffff;
transform-origin: left;
transform: scaleX(0);
}
.one:hover::after {
transform: scaleX(1);
}


When the mouse moves up, it will div Will appear .
It can be used transition To control the speed of occurrence .
边栏推荐
- How to deal with message blackout and message sending failure of Aurora im
- What do you need to know about Amazon evaluation?
- Set the IP address using batch
- Super (subclass)__ init__ And parent class__ init__ ()
- [daily exercise] 217 Duplicate element exists
- Control your phone with genymotion scratch
- Don't be afraid of xxE vulnerabilities: understand their ferocity and detection methods
- View controller and navigation mode
- SQLI_ LIBS range construction and 1-10get injection practice
- Activity start process record
猜你喜欢

Pycharm usage experience

Jsonobject jsonarray for parsing

Summarize the five most common BlockingQueue features

AltiumDesigner2020导入3D Body-SOLIDWORKS三维模型

Moteur de modèle de moteur thymeleaf

Global case | how an airline with a history of 100 years can expand and transform to promote innovation in the aviation industry

NDK learning notes (V)

Twitter data collection (content, fans, keywords, etc.)

NDK learning notes (XI) POSIX sockect local communication

Yonghong Bi product experience (I) data source module
随机推荐
[daily exercises] merge two ordered arrays
Squid agent
OJDBC在Linux系统下Connection速度慢解决方案
Getting started with kotlin
Servlet
VSCode插件开发
Write a list with kotlin
Observer mode (listener mode) + thread pool to realize asynchronous message sending
All the benefits of ci/cd, but greener
Installing and using sublist3r in Kali
Qmake implementation of QT project Pro script to vs solution
NDK learning notes (12) native graphics API, using avilib to create an avi video player
NDK learning notes (VI) Basics: memory management, standard file i/o
Jsonobject jsonarray for parsing
What happened to the young man who loved to write code -- approaching the "Yao Guang young man" of Huawei cloud
Do we really need conference headphones?
Activity start process record
Fix [no Internet, security] problem
[usual practice] explore the insertion position
What is a thread pool?