Adaptive Placeholders
https://wisdmlabs.com/blog/create-adaptive-placeholders-using-css/
https://circleci.com/blog/adaptive-placeholders/
https://stackoverflow.com/questions/47983822/css-operator-adaptive-placeholder-contact-form-7-wordpress
<!DOCTYPE html>
<html lang="zh-cn">
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
<title>Adaptive Placeholder – 自适应的占位符效果</title> <style type="text/css"> body {
background-color: #FAFAFA;
}
.top-banner {
background: #555;
}
input[type=text] {
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
width: 100%;
height: -webkit-calc(3em + 2px);
height: calc(3em + 2px);
margin: 0 0 1em;
padding: 1em;
border: 1px solid #cccccc;
border-radius: 1.5em;
background: #fff;
resize: none;
outline: none;
}
input[type=text][required]:focus {
border-color: #00bafa;
}
input[type=text][required]:focus + label[placeholder]:before {
color: #00bafa;
}
input[type=text][required]:focus + label[placeholder]:before, input[type=text][required]:valid + label[placeholder]:before {
-webkit-transition-duration: .2s;
transition-duration: .2s;
-webkit-transform: translate(0, -1.5em) scale(0.9, 0.9);
-ms-transform: translate(0, -1.5em) scale(0.9, 0.9);
transform: translate(0, -1.5em) scale(0.9, 0.9);
}
input[type=text][required]:invalid + label[placeholder][alt]:before {
content: attr(alt);
}
input[type=text][required] + label[placeholder] {
display: block;
pointer-events: none;
line-height: 2.3em;
margin-top: -webkit-calc(-3em - 2px);
margin-top: calc(-3em - 2px);
margin-bottom: -webkit-calc((3em - 1em) + 2px);
margin-bottom: calc((3em - 1em) + 2px);
}
input[type=text][required] + label[placeholder]:before {
content: attr(placeholder);
display: inline-block;
margin: 0 -webkit-calc(1em + 2px);
margin: 0 calc(1em + 2px);
padding: 0 2px;
color: #898989;
white-space: nowrap;
-webkit-transition: 0.3s ease-in-out;
transition: 0.3s ease-in-out;
background-image: -webkit-gradient(linear, left top, left bottom, from(#ffffff), to(#ffffff));
background-image: -webkit-linear-gradient(top, #ffffff, #ffffff);
background-image: linear-gradient(to bottom, #ffffff, #ffffff);
-webkit-background-size: 100% 5px;
background-size: 100% 5px;
background-repeat: no-repeat;
background-position: center;
} *, *:after, *:before { -webkit-box-sizing: border-box; -moz-box-sizing: border-box; box-sizing: border-box; }
.clearfix:after{visibility:hidden;display:block;font-size:0;content:" ";clear:both;height:0}
.clearfix{*zoom:1}
.fl{float:left}
.fr{float:right}
.fl,.fr{_display:inline}
.top-banner {
position:absolute;
z-index: 999;
left:0;
top:0;
height:40px;
line-height:40px;
padding:0 30px;
width:100%;
font-size: 13px;
background-color: rgba(255, 255, 255, 0.15);
color: #fff;
font-family: "宋体","Microsoft Yahei","Helvetica Neue",Helvetica,Arial,sans-serif;
font-size: 15px;
/*text-shadow: 1px 1px 3px #333;*/
/*box-shadow: 0 1px 0 #999;*/
}
.top-banner a {
color: #fff;
text-decoration: none;
}
</style>
<script type="text/javascript">
$(function() {
$("input[id$=address]").qtip({
content: '涂聚文告诉你,好样的'
});
});
</script> </head> <body>
<div style="width:400px;height:100px;margin:300px auto">
<form>
<input required='必须填写' type='text' class="name" id="name">
<label alt='请输入姓名' placeholder='姓名'></label>
<input required='必须填写' type='text' class="address" id="address">
<label alt='请输入地址' placeholder='地址'></label> </form>
</div>
<div class="footer-banner" style="width:728px; margin:200px auto 0"></div>
<script src="js/jquery.min.js"></script>
</body>
</html>

Adaptive Placeholders的更多相关文章
- 移动端web自适应解决方案: adaptive.js
代码有更新,最好直接查看github github:https://github.com/finance-sh/adaptive adaptivejs利用rem解决移动端页面开发的自适应问题 页面模板 ...
- 【Win 10应用开发】Adaptive磁贴模板的XML文档结构
在若干天之前,老周给大家讲了Adaptive Toast通知的XML模板,所以相应地,今天老周给大家介绍一下Adaptive磁贴的新XML模板. 同样道理,你依旧可以使用8.1时候的磁贴模板,在win ...
- [MySQL] Buffer Pool Adaptive Flush
Buffer Pool Adaptive Flush 在MySQL的帮助文档中Tuning InnoDB Buffer Pool Flushing提到, innodb_adaptive_flushin ...
- Adaptive Placeholder – 自适应的占位符效果
在早期,我们都是通过使用 JavaScript 来实现占位符功能.而现在,HTML5 原生提供的 placeholder 属性让我们在现代浏览器轻松就能实现这样的功能.这里向大家分享一个自适应的占位符 ...
- Adaptive Backgrounds – jQuery 自适应背景插件
Adaptive Backgrounds 是一款很特别的 jQuery 插件,可以从图像中提取主导颜色并将它应用到它的父元素.这个插件利用 Canvas 元素和 ImageData 对象.需要注意的是 ...
- Adaptive Code Via C#读书笔记
原书链接: http://www.amazon.com/Adaptive-Code-via-principles-Developer-ebook/dp/B00OCLLYTY/ref=dp_kinw_s ...
- Win 10 开发中Adaptive磁贴模板的XML文档结构,Win10 应用开发中自适应Toast通知的XML文档结构
分享两篇Win 10应用开发的XML文档结构:Win 10 开发中Adaptive磁贴模板的XML文档结构,Win10 应用开发中自适应Toast通知的XML文档结构. Win 10 开发中Adapt ...
- Correlation Filter in Visual Tracking系列一:Visual Object Tracking using Adaptive Correlation Filters 论文笔记
Visual Object Tracking using Adaptive Correlation Filters 一文发表于2010的CVPR上,是笔者所知的第一篇将correlation filt ...
- [Notes] Reading Notes on [Adaptive Robot Control – mxautomation J. Braumann 2015]
Reading sources: 1.Johannes Braumann, Sigrid Brell-Cokcan, Adaptive Robot Control (ARC ) Note: buil ...
随机推荐
- 使用 TRESTClient 與 TRESTRequest 作為 HTTP Client 之二 (POST 檔案)
使用 HTML 进行文件上传,已经是很平常的应用了,在手机App里面,也常常会用到这个作业,例如拍照上传,或是从相簿选取照片上传,都是很常见的. 在 HTML 的 Form 里面,要让使用者选择文件上 ...
- [译]async/await中阻塞死锁
这篇博文主要是讲解在async/await中使用阻塞式代码导致死锁的问题,以及如何避免出现这种死锁.内容主要是从作者Stephen Cleary的两篇博文中翻译过来. 原文1:Don'tBlock o ...
- [Swift]LeetCode567. 字符串的排列 | Permutation in String
Given two strings s1 and s2, write a function to return true if s2 contains the permutation of s1. I ...
- [Swift]LeetCode728. 自除数 | Self Dividing Numbers
A self-dividing number is a number that is divisible by every digit it contains. For example, 128 is ...
- Java常用工具类练习题
1.请根据控制台输入的特定日期格式拆分日期 如:请输入一个日期(格式如:**月**日****年) 经过处理得到:****年**月**日 提示:使用String的方法indexOf.lastIndexO ...
- python编译、运行、反编译pyc文件
为了加密 .py 文件,以前一般使用打包成 exe ,但是最近发现可以将其编译成二进制文件 pyc ,虽然反编译难度不大,但是也需要一些水平 编译生成 pyc: 单个文件 代码: import py_ ...
- Python内置函数(44)——next
英文文档: next(iterator[, default]) Retrieve the next item from the iterator by calling its __next__() m ...
- SpringCloud(9)---mysql实现配置中心
mysql实现配置中心 本公司配置数据的管理是通过mysql进行配置管理,因为已经搭建好了,所以自己动手重新搭建一遍,熟悉整个流程.有关项目源码后期会补上github地址 微服务要实现集中管理微服务配 ...
- JVM虚拟机(1)---常用JVM配置参数
常用JVM配置参数 常用JVM配置参数主要有:Trace跟踪参数.堆的分配参数.栈的分配参数. 一.Trace跟踪参数 跟踪参数用于跟踪监控JVM,对于开发人员来讲用于JVM调优以及故障排查的. 1. ...
- Ocelot中使用Butterfly实践
Ocelot(https://github.com/TomPallister/Ocelot)是一个用.net core实现的API网关,Butterfly(https://github.com/But ...