当前位置:网站首页>Realization of search box effect [daily question]
Realization of search box effect [daily question]
2022-07-07 13:56:00 【zx_ twenty million two hundred and twenty thousand one hundred 】
Search box is a very common function , therefore , Today, let's practice the effect of writing a search box , I hope this exercise today is helpful to you , Now let's see the final effect of today's exercise :

HTML Code :
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>【 Practice every day 】18— Implementation of search box effect </title>
</head>
<body>
<div class="search">
<div class="icon"></div>
<div class="input">
<input type="text" name="" id="SearchInput" placeholder="Search">
</div>
<span class="clear" onclick="document.getElementById('SearchInput').value = ''"></span>
</div>
<script type="text/javascript">
const icon = document.querySelector('.icon');
const search = document.querySelector('.search');
icon.onclick = function(){
search.classList.toggle('active');
}
</script>
</body>
</html>CSS Code :
*
{
margin: 0;
padding: 0;
box-sizing: border-box;
font-family: 'Poppins', sans-serif;
}
body
{
position: relative;
display: flex;
justify-content: center;
align-items: center;
min-height: 100vh;
background: #fafafa;
}
.search
{
position: relative;
width: 60px;
height: 60px;
background: #fff;
border-radius: 60px;
overflow: hidden;
transition: 0.5s;
box-shadow: 0 0 0 2px #00a6bc;
}
.search.active
{
width: 360px;
}
.search .icon
{
position: absolute;
left: 0;
top: 0;
width: 60px;
height: 60px;
background: #fff;
display: flex;
justify-content: center;
align-items: center;
cursor: pointer;
z-index: 1;
}
.search .icon:before
{
content: '';
position: absolute;
width: 15px;
height: 15px;
border: 3px solid #00a6bc;
border-radius: 50%;
transform: translate(-4px,-4px);
transition: 0.5s;
}
.search .icon:after
{
content: '';
position: absolute;
width: 3px;
height: 12px;
background:#00a6bc;
transform: translate(6px,6px) rotate(315deg);
}
.search .input
{
position: relative;
width: 300px;
height: 60px;
left: 60px;
background: #f0f;
display: flex;
justify-content: center;
align-items: center;
}
.search .input input
{
position: absolute;
top: 0;
width: 100%;
height: 100%;
padding: 10px 0;
border: none;
outline: none;
font-size: 18px;
}
.clear
{
position: absolute;
top: 50%;
transform: translateY(-50%);
right: 15px;
width: 15px;
height: 15px;
display: block;
background: #fff;
cursor: pointer;
display: flex;
justify-content: center;
align-items: center;
}
.clear:before
{
position: absolute;
content: '';
width: 1px;
height: 15px;
background: #999;
transform: rotate(45deg);
}
.clear:after
{
position: absolute;
content: '';
width: 1px;
height: 15px;
background: #999;
transform: rotate(315deg);
}The above is the whole content of daily practice , I hope today's little exercise is useful to you , If you think it helps , Please praise me , Pay attention to me !
边栏推荐
- SSRF vulnerability file pseudo protocol [netding Cup 2018] fakebook1
- Flink | 多流转换
- Build a secure and trusted computing platform based on Kunpeng's native security
- Mysql怎样控制replace替换的次数?
- Excerpt from "misogyny: female disgust in Japan"
- 云计算安全扩展要求关注的安全目标和实现方式区分原则有哪些?
- 得物客服热线的演进之路
- Redis只能做缓存?太out了!
- DID登陆-MetaMask
- Help tenants
猜你喜欢

Show the mathematical formula in El table

1. Deep copy 2. Call apply bind 3. For of in differences

566. 重塑矩阵

Xshell connection server changes key login to password login

2022-7-6 Leetcode 977. Square of ordered array

Esp32 ① compilation environment

提升树莓派性能的方法

Deep understanding of array related problems in C language
![[fortress machine] what is the difference between cloud fortress machine and ordinary fortress machine?](/img/fb/17e029b1d955965d7e2e0f58701d91.png)
[fortress machine] what is the difference between cloud fortress machine and ordinary fortress machine?

Social responsibility · value co creation, Zhongguancun network security and Information Industry Alliance dialogue, wechat entrepreneur Haitai Fangyuan, chairman Mr. Jiang Haizhou
随机推荐
flask session伪造之hctf admin
Use of polarscatter function in MATLAB
2022-7-7 Leetcode 844.比较含退格的字符串
Flink | multi stream conversion
Leetcode simple question sharing (20)
The difference between memory overflow and memory leak
118. Yanghui triangle
带你掌握三层架构(建议收藏)
Did login metamask
供应链供需预估-[时间序列]
2022-7-7 Leetcode 34.在排序数组中查找元素的第一个和最后一个位置
move base参数解析及经验总结
Introduction to database system - Chapter 1 introduction [conceptual model, hierarchical model and three-level mode (external mode, mode, internal mode)]
Data refresh of recyclerview
Realize the IP address home display function and number home query
参数关键字Final,Flags,Internal,映射关键字Internal
1. Deep copy 2. Call apply bind 3. For of in differences
2022-7-6 beginner redis (I) download, install and run redis under Linux
Help tenants
C语言数组相关问题深度理解