input相关问题总结
1. 禁止为所有被激活的输入框添加边框
*:focus {outline: none}
2. 禁止为被激活的输入框添加边框,说明:".abc"为输入框对象自定义添加的class类命名。
.abc:focus{ outline:none }
3. 也可以自定义输入框被激活时的边框样式
.abc:focus { outline:Blue Solid 4px;}
4.为所有input为text password 的设置激活时的边框样式
input[type="text"]:focus, input[type="password"]:focus { border: 1px #1E90FF solid; background-color: #fff;box-shadow: 0 0 4px rgba(30,144,255,.5);}
5.把input写在label里面 无论是点击文字 还是复选框 都可以勾选复选框
<P><label><input type="checkbox" />点我 <label><input type="checkbox" />点我 <label><input type="checkbox" />点我 </P>
6.给多个input加focus样式
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title></title>
<style type="text/css">
body{
font:normal 12px/17px Arial;
}
div{
padding:2px;
}
input, textarea {
width: 12em;
border: 1px solid #888;
}
.focus {
border: 1px solid #f00;
background: #fcc;
}
</style>
<!-- 引入jQuery -->
<script src="http://libs.baidu.com/jquery/1.9.0/jquery.js" type="text/javascript"></script>
<script type="text/javascript">
$(function(){
$(":input").focus(function(){
$(this).addClass("focus");
if($(this).val() ==this.defaultValue){
$(this).val("");
}
}).blur(function(){
$(this).removeClass("focus");
if ($(this).val() == '') {
$(this).val(this.defaultValue);
}
});
})
</script> </head>
<body>
<form action="" method="post" id="regForm">
<fieldset>
<legend>个人基本信息</legend>
<div>
<label for="username">名称:</label>
<input id="username" type="text" value="名称" />
</div>
<div>
<label for="pass">密码:</label>
<input id="pass" type="password" value="密码" />
</div>
<div>
<label for="msg">详细信息:</label>
<textarea id="msg" rows="2" cols="20">详细信息</textarea>
</div>
</fieldset>
</form>
</body>
</html>
7.
<input type="text" value="搜索" placeholder="搜索" onfocus="this.value=''" />
默认颜色鼠标点击字体颜色变浅 输入后文字自动消失
input相关问题总结的更多相关文章
- input相关
input相关 在ios中输入英文首字母默认大写取消方法 <input autocapitalize="off" autocorrect="off" /& ...
- CSS:与input相关的一些样式设置问题
input是HTML中非常重要,非常常用而又不可替代的元素,在于其相关的样式设置中有时会遇到其他元素不会发生的问题,今天把我印象中的一些小问题和解决方案记录一下. 1.与同行元素上下居中对齐 关于上下 ...
- ionic angularJS input 相关指令 以及定时器 的使用
<!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" conte ...
- PHP输入流 php://input 相关【转】
为什么xml_rpc服务端读取数据都是通过file_get_contents(‘php://input', ‘r').而不是从$_POST中读取,正是因为xml_rpc数据规格是xml,它的Conte ...
- 16.和input相关的知识点
1.改变input里面placeholder颜色 <input class="pre_name" type="text" placeholder=&quo ...
- js input相关事件(转载)
1.onfocus 当input 获取到焦点时触发. 2.onblur 当input失去焦点时触发,注意:这个事件触发的前提是已经获取了焦点再失去焦点的时候才会触发该事件,用于判断标签为空.3.o ...
- input 相关
1.label 标签 for 属性同 input 标签 id 属性联系之一
- input的type=file触发的相关事件
与input相关的事件运行的过程.添加了一些相关的方法测试了一下.input的type=file的运行流程. 我们书写了mousedown,mouseup,click,input,change,foc ...
- android adb shell input各种妙用
项目中使用一个开发版,预留两个usb接口.类似华硕TinkerBoard. 一个用户连接摄像头,一个用于adb调试.结果就没了鼠标的接口.多次切换鼠标和摄像头插头,非常不方便,带摄像头的app没法调试 ...
随机推荐
- 通讯录(ios自带有界面)
1.添加AddressBookUI.framework框架 2控制器中实现 #import "ViewController.h" #import <AddressBookUI ...
- 数据分析(4):Scipy
科学计算 最小二乘leastsq # -*- coding: utf-8 -*- def func(x,p): # p 参数列表 A,k,theta = p; # 可以一一对应赋值 return A* ...
- IMAGE_LOAD_CONFIG_DIRECTORY64 SafeSEH检测 表
IMAGE_LOAD_CONFIG_DIRECTORY64 typedef struct { DWORD Size; DWORD TimeDateStamp; WORD MajorVersion; W ...
- DNS常用命令
ipconfig/ifconfig 显示网络信息 nslookup host 查询域名对应的ip同时也显示了网关地址 cat /etc/resolv.conf 查看本地dns服务器地 ...
- SPOJ PHRASES 后缀数组
题目链接:http://www.spoj.com/problems/PHRASES/en/ 题意:给定n个字符串,求一个最长的子串至少在每个串中的不重叠出现次数都不小于2.输出满足条件的最长子串长度 ...
- POJ 2002 统计正方形 HASH
题目链接:http://poj.org/problem?id=2002 题意:给定n个点,问有多少种方法可以组成正方形. 思路:我们可以根据两个点求出对应正方形[有2个一个在两点左边,一个在两点右边] ...
- springmvc导出excel并弹出下载框
https://my.oschina.net/aptx4869/blog/298507
- web api :Routing in ASP.NET Web API
引 Web API 和SignalR都是在服务层. If you are familiar with ASP.NET MVC, Web API routing is very similar to M ...
- thrift 学习
入门教程: http://blog.zhengdong.me/2012/05/10/hello-world-by-thrift-using-java
- myeclipse操作记录
myeclipse里面jsp页面里面js注释快捷键 ctrl + shift +cctrl + / MyEclipse 每次保存都要building workspace的解决方法 方法一:菜单栏-&g ...