首页 > 其他分享 >纯css+html实现伸缩式动态搜索框

纯css+html实现伸缩式动态搜索框

时间:2022-09-22 14:24:31浏览次数:59  
标签:40px search txt height padding width html 伸缩式 css

<div class="search-box">   <a class="search-btn">     <i class="fa fa-search" aria-hidden="true"></i>   </a>   <input type="text" class="search-txt" placeholder="搜索" />   <div class="search-line"></div> </div>   body {     margin: 0;     padding: 0;     width: 100%;     height: 100%;     background: #f8cb59; } .search-line {     position: absolute;     left: 62px;     bottom: 10px;     width: 0px;     height: 2px;     ">rgb(251, 121, 0);     transition: 0.3s; } .search-box {     position: absolute;     bottom: 30px;     left: 30px;     ">white;     box-shadow: 0 2px 25px 0 rgba(0, 0, 0, 0.1);     height: 40px;     padding: 10px;     border-radius: 40px;     display: flex; } .search-txt {     border: none;     background: none;     outline: none;     padding: 0;     color: #222;     font-size: 16px;     line-height: 40px;     width: 0;     transition: 0.4s; } .search-btn {     color: #888888;     font-size: 24px;     width: 40px;     height: 40px;     border-radius: 50%;     display: flex;     justify-content: center;     align-items: center;     cursor: pointer;     transition: 0.4s; } .search-box:hover .search-txt {     width: 200px;     padding: 0 12px; } .search-box:hover .search-btn {     ">;     animation: rotate 0.4s linear; } .search-txt:focus {     width: 200px;     padding: 0 12px; }
.search-txt:focus + .search-line {     width: 200px; }
@keyframes rotate {     0% {         transform: rotate(0deg);     }     100% {         transform: rotate(360deg);     } }

标签:40px,search,txt,height,padding,width,html,伸缩式,css
From: https://www.cnblogs.com/czb1218/p/16719080.html

相关文章

  • python接收微信消息报'HTMLParser' object has no attribute 'unescape'错误
    我的博客一直有个想法,想要弄个微信机器人,然而出师不利,刚开始就碰壁了先上代码,这个是用来接收消息的,是个测试脚本#!/usr/bin/python#coding:utf-8importitchatd......
  • CSS3渐变
    简介CSS3渐变(gradients)可以让你在两个或多个指定的颜色之间显示平稳的过渡。以前,你必须使用图像来实现这些效果。但是,通过使用CSS3渐变(gradients),你可以减少下载的时间......
  • CSS 中的选择器类型
    CSS中的选择器类型CSSPhotoby潘卡伊·帕特尔on不飞溅在CSS中,选择器起着至关重要的作用。在这里,您可以根据示例查看选择器的类型。在此之前,了解特异性很重要,......
  • CSS带小三角形的div框
    效果图:<spanclass="hint_prompt">超时20天</span>.hint_prompt{border:1pxsolid#fff1f0;border-radius:4px;margin:50px;text-align:center;bor......
  • CSS3动画
    简介CSSanimations使得可以将从一个CSS样式配置转换到另一个CSS样式配置。动画包括两个部分:描述动画的样式规则和用于指定动画开始、结束以及中间点样式的关键帧。......
  • css 列表样式,<a> 连接文字超长省略
    <!DOCTYPEhtml><htmllang="en"><head><metacharset="UTF-8"><metahttp-equiv="X-UA-Compatible"content="IE=edge"><metaname="viewport"content......
  • 仅使用 CSS 和 HTML 制作动画加载屏幕
    仅使用CSS和HTML制作动画加载屏幕关于如何仅使用CSS和HTML开发动画加载屏幕的教程编写一个简单的加载屏幕很容易。但是编写一个可以移动的动画加载屏幕确实具有......
  • CSS:浏览器的内核及了解,有哪些常见的浏览器内核?(面试题)
    浏览器的内核及了解?有哪些常见的浏览器内核?     浏览器要渲染出网页给用户看必须加载htm编码和js脚本渲染引擎渲染页面的UI和jd执行引擎操作内存,就是浏览器的内......
  • html jsp 引入js
    如果在jsp文件中引入静态文件比如(.js或.css等等),可以在使用 /项目名称/路径 的方式,但是这种方式如果在修改了项目了名称后就显得比较麻烦了。除了之外还许多方式,比如相......
  • CSS的优先级如何计算?
    选择器的特殊性值分为四个等级行内样式:X000id选择器:0X00类选择器/伪类选择器/属性选择器:00X0元素选择器/伪元素选择器:000X在判断优先级时先看是否......