您现在的位置是:网站首页> 编程资料编程资料
纯CSS3实现漂亮的input输入框动画样式库(Text input love)HTML中利用div+CSS实现简单的箭头图标的代码css 11种方法实现一个tips带有描边的小箭头css实现带箭头和圆点的轮播可自定义箭头样式的CSS3气泡提示框CSS3制作可自定义配置箭头的气泡提示框效果源码基于CSS实现带阴影和小箭头的黑色风格下拉菜单效果CSS实现让同一行文字和输入框对齐的方法利用HTML、CSS 实现带表情的评论框的制作教程CSS实现带箭头的提示框效果【示例代码】
2023-10-08
367人已围观
简介 本文分享一个用纯 CSS3 实现的,漂亮的 input 输入框动画样式库-Text input love。小编觉得挺不错的,现在分享给大家,也给大家做个参考。一起跟随小编过来看看吧
分享一个用纯 CSS3 实现的,漂亮的 input 输入框动画样式库-Text input love。
点击每个输入框都用不同的动画效果,始终显示标签label,并显示 placeholder(占位符)文本。

演示地址:https://codepen.io/MichaelArestad/full/ohLIa
HTML 代码:
Click every input.
SCSS 代码:
Sass 代码:
@import "compass/css3"; @import url(https://fonts.googleapis.com/css?family=Open+Sans:400,700,600,300,800); * { box-sizing: border-box; } html, body { overflow-x: hidden; font-family: "Open Sans", sans-serif; font-weight: 300; color: #fff; background: #efefef; } @mixin epic-sides() { // https://codepen.io/MichaelArestad/pen/qltuk position: relative; z-index: 1; &:before { position: absolute; content: ""; display: block; top: 0; left: -5000px; height: 100%; width: 15000px; z-index: -1; @content; } } .row { max-width: 800px; margin: 0 auto; padding: 60px 30px; background: #032429; @include epic-sides() {background: inherit;} text-align: center; &:first-child { padding: 40px 30px; } &:nth-child(2), &:nth-child(8), &:nth-child(10){ background: #134A46; } &:nth-child(3), &:nth-child(7) { background: #377D6A; } &:nth-child(4), &:nth-child(6) { background: #7AB893; } &:nth-child(5) { background: #B2E3AF; } span { position: relative; display: inline-block; margin: 30px 10px; } } .basic-slide { display: inline-block; width: 215px; padding: 10px 0 10px 15px; font-family: "Open Sans", sans; font-weight: 400; color: #377D6A; background: #efefef; border: 0; border-radius: 3px; outline: 0; text-indent: 70px; // Arbitrary. transition: all .3s ease-in-out; &::-webkit-input-placeholder { color: #efefef; text-indent: 0; font-weight: 300; } + label { display: inline-block; position: absolute; top: 0; left: 0; padding: 10px 15px; text-shadow: 0 1px 0 rgba(19,74,70,.4); background: #7AB893; transition: all .3s ease-in-out; border-top-left-radius: 3px; border-bottom-left-radius: 3px; } } .basic-slide:focus, .basic-slide:active { color: #377D6A; text-indent: 0; background: #fff; border-top-left-radius: 0; border-bottom-left-radius: 0; &::-webkit-input-placeholder { color: #aaa; } + label { transform: translateX(-100%); } } .clean-slide { position: relative; display: inline-block; width: 215px; padding: 10px 0 10px 15px; font-family: "Open Sans", sans; font-weight: 400; color: #377D6A; background: #efefef; border: 0; border-radius: 3px; outline: 0; text-indent: 60px; // Arbitrary. transition: all .3s ease-in-out; &::-webkit-input-placeholder { color: #efefef; text-indent: 0; font-weight: 300; } + label { display: inline-block; position: absolute; transform: translateX(0); top: 0; left: 0; bottom: 0; padding: 13px 15px; font-size: 11px; font-weight: 700; text-transform: uppercase; color: #032429; text-align: left; text-shadow: 0 1px 0 rgba(255,255,255,.4); transition: all .3s ease-in-out, color .3s ease-out; border-top-left-radius: 3px; border-bottom-left-radius: 3px; overflow: hidden; &:after { content: ""; position: absolute; top: 0; right: 100%; bottom: 0; width: 100%; background: #7AB893; z-index: -1; transform: translate(0); transition: all .3s ease-in-out; border-top-left-radius: 3px; border-bottom-left-radius: 3px; } } } .clean-slide:focus, .clean-slide:active { color: #377D6A; text-indent: 0; background: #fff; border-top-left-radius: 0; border-bottom-left-radius: 0; &::-webkit-input-placeholder { color: #aaa; } + label { color: #fff; text-shadow: 0 1px 0 rgba(19,74,70,.4); transform: translateX(-100%); &:after { transform: translate(100%); } } } .gate { display: inline-block; width: 215px; padding: 10px 0 10px 15px; font-family: "Open Sans", sans; font-weight: 400; color: #377D6A; background: #efefef; border: 0; border-radius: 3px; outline: 0; text-indent: 65px; // Arbitrary. transition: all .3s ease-in-out; &::-webkit-input-placeholder { color: #efefef; text-indent: 0; font-weight: 300; } + label { display: inline-block; position: absolute; top: 0; left: 0; padding: 10px 15px; text-shadow: 0 1px 0 rgba(19,74,70,.4); background: #7AB893; transition: all .4s ease-in-out; border-top-left-radius: 3px; border-bottom-left-radius: 3px; transform-origin: left bottom; z-index: 99; &:before, &:after { content: ""; position: absolute; top: 0; right: 0; bottom: 0; left: 0; border-radius: 3px; background: #377D6A; transform-origin: left bottom; transition: all .4s ease-in-out; pointer-events: none; z-index: -1; } &:before { background: rgba(3,36,41,.2); z-index: -2; right: 20%; } } } span:nth-child(2) .gate { text-indent: 85px; } span:nth-child(2) .gate:focus, span:nth-child(2) .gate:active{ text-indent: 0; } .gate:focus, .gate:active { color: #377D6A; text-indent: 0; background: #fff; border-top-right-radius: 3px; border-bottom-right-radius: 3px; &::-webkit-input-placeholder { color: #aaa; } + label { transform: rotate(-66deg); border-radius: 3px; &:before { transform: rotate(10deg); } } } .skinny { display: inline-block; width: 215px; padding: 10px 0 10px 15px; font-family: "Open Sans", sans; font-weight: 400; color: #377D6A; background: #efefef; border: 0; border-radius: 3px; outline: 0; text-indent: 75px; // Arbitrary. transition: all .3s ease-in-out; &::-webkit-input-placeholder { color: #efefef; text-indent: 0; font-weight: 300; } + label { display: inline-block; position: absolute; transform: translateX(0); top: 0; left: 0; padding: 10px 15px; text-shadow: 0 1px 0 rgba(19,74,70,.4); transition: all .3s ease-in-out; border-top-left-radius: 3px; border-bottom-left-radius: 3px; overflow: hidden; &:before, &:after { content: ""; position: absolute; right: 0; left: 0; z-index: -1; transition: all .3s ease-in-out; } &:before { // Skinny bit here top: 5px; bottom: 5px; background: #377D6A; // change this to #134A46 border-top-left-radius: 3px; border-bottom-left-radius: 3px; } &:after { top: 0; bottom: 0; background: #377D6A; } } } .skinny:focus, .skinny:active { color: #377D6A; text-indent: 0; background: #fff; &::-webkit-input-placeholder { color: #aaa; } + label { transform: translateX(-100%); &:after { transform: translateX(100%); } } } .slide-up { display: inline-block; width: 215px; padding: 10px 0 10px 15px; font-family: "Open Sans", sans; font-weight: 400; color: #377D6A; background: #efefef; border: 0; border-radius: 3px; outline: 0; text-indent: 80px; // Arbitrary. transition: all .3s ease-in-out; &::-webkit-input-placeholder { color: #efefef; text-indent: 0; font-weight: 300; } + label { display: inline-block; position: absolute; transform: translateX(0); top: 0; left: 0; padding: 10px 15px; text-shadow: 0 1px 0 rgba(19
相关内容
- CSS3下的渐变文字效果实现示例css 进度条的文字根据进度渐变的示例代码css3实现文字扫光渐变动画效果的示例CSS3文字背景色渐变过渡特效源码CSS实现文字高光水波渐变的动态效果实例一款纯css3实现的颜色渐变按钮的代码教程使用CSS3的背景渐变Text Gradient 创建文字颜色渐变CSS 网页文字渐变效果css实现文字颜色渐变的三种方法
- css自定义属性和聚光灯效果的实现最新Edge浏览器将支持CSS自定义属性深入解析CSS中的自定义属性css如何实现自定义更为美观的链接提示效果初步认识css自定义属性
- 纯CSS实现红绿灯效果(面试常见)你应该知道的5个CSS面试问题小结前端HTML+CSS笔试题面试题前端面试必备之CSS3的新特性面试时可能被问到的一些CSS问题CSS常见面试问题汇总(推荐)
- css制作超萌吃豆豆加载动画效果纯CSS3实现的多层圆环loading加载动画特效源码纯CSS3实现带有卫星轨道旋转效果的加载动画特效源码CSS 的加载及加载顺序简介css3 animation制作loading白色圆点滑过加载动画特效源码纯CSS3仿Skype圆点旋转加载动画特效源码html5+css3实现的多彩旋转式svg加载动画特效源码CSS制作提示框 ‘正在加载请。。。。。’
- css制作收缩圆环旋转效果实例代码css3 clip实现圆环进度条的示例代码图解CSS3制作圆环形进度条的实例教程CSS实现圆环旋转加载动画实现CSS圆环的5种方法(小结)
- 迪士尼疯狂猜图 国家地区 图文答案大全_手机游戏_游戏攻略_
- 迪士尼疯狂猜图 节日纪念日 图文答案大全 _手机游戏_游戏攻略_
- 迪士尼疯狂猜图 公共标识 图文答案大全 _手机游戏_游戏攻略_
- 迪士尼疯狂猜图 历史人物 图文答案大全_手机游戏_游戏攻略_
- 迪士尼疯狂猜图 成语篇 图文答案大全 _手机游戏_游戏攻略_
点击排行
本栏推荐
