html 搜索页面模板,SVG+HTML5 搜索界面模板

本文介绍了一个使用纯CSS实现的交互式搜索框动画效果。通过CSS3的transform和transition属性,实现了搜索图标到输入框的平滑过渡。文章详细展示了如何设置元素的位置、尺寸以及动画效果。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

CSS

语言:

CSSSCSS

确定

body {

color: #b3c33a;

background-color: #333;

}

.search {

position: absolute;

top: 50%;

left: 50%;

margin-left: -300px;

margin-top: -54px;

width: 600px;

}

svg {

position: absolute;

transform: translateX(-246px);

width: 600px;

height: auto;

stroke-width: 8px;

stroke: #b3c33a;

stroke-width: 1px;

stroke-dashoffset: 0;

stroke-dasharray: 64.6 206.305;

transition: all 0.5s ease-in-out;

}

.input-search {

position: absolute;

width: calc(100% - 148px);

height: 64px;

top: 0;

right: 20px;

bottom: 0;

left: 0;

border: none;

background-color: transparent;

outline: none;

padding: 20px;

font-size: 50px;

}

.search-label {

position: absolute;

display: block;

width: 108px;

height: 108px;

top: 0;

left: 50%;

margin-left: -54px;

z-index: 100;

transition: 0.5s ease-in-out;

}

.isActive .search-label {

transform: translateX(246px);

}

.isActive svg {

stroke-dashoffset: -65;

stroke-dasharray: 141.305 65;

transform: translateX(0);

}

.isActive.full svg {

stroke-dashoffset: -65;

stroke-dasharray: 141.305 65;

transform: translateX(0);

}

.full .search-label {

transform: translateX(246px);

}

.full svg {

stroke-dashoffset: 0;

stroke-dasharray: 64.6 206.305;

transform: translateX(0);

}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值