在HTML中,通过各种各样的属性可以给元素增加很多附加的信息,了解和掌握css3一些的选择器,是很有必要的。
:enabled 和 :disabled选择器
表单元素有可用(“:enabled”)和不可用(“:disabled”)状态
<form action="#">
<div>
<label for="name">Text Input:</label>
<input type="text" name="name" id="name" placeholder="可用输入框" enabled/>
</div>
<div>
<label for="text">Text Input:</label>
<input type="text" name="name" id="text" placeholder="禁用输入框" disabled />
</div>
</form>
 <style>
div{
margin: 20px;
} input {
background: #fff;
padding: 10px;
border: 1px solid orange;
border-radius: 3px;
}
input[type="text"]:enabled {
background: #ccc;
border: 2px solid red;
} input[type="text"]:disabled {
background: rgba(0,0,0,.15);
border: 1px solid rgba(0,0,0,.15);
color: rgba(0,0,0,.15);
}
</style>

:checked选择器  表示的是选中状态
<form action="#">
<div class="wrapper">
<div class="box">
<input type="radio" checked="checked" id="boy" name="1" /><span></span>
</div>
<label for="boy">男</label>
</div> <div class="wrapper">
<div class="box">
<input type="radio" id="girl" name="1" /><span></span>
</div>
<label for="girl">女</label>
</div>
</form>
 <style>
form {
border: 1px solid #ccc;
padding: 20px;
width: 300px;
margin: 30px auto;
}
.wrapper {
margin-bottom: 10px;
}
.box {
display: inline-block;
width: 30px;
height: 30px;
margin-right: 10px;
position: relative;
background: orange;
vertical-align: middle;
border-radius: 100%;
}
.box input {
opacity:;
position: absolute;
top:;
left:;
width: 100%;
height:100%;
z-index:;/*使input按钮在span的上一层,不加点击区域会出现不灵敏*/
} .box span {
display: block;
width: 10px;
height: 10px;
border-radius: 100%;
position: absolute;
background: #fff;
top: 50%;
left:50%;
margin: -5px 0 0 -5px;
z-index:;
} input[type="radio"] + span {
opacity:; }
input[type="radio"]:checked+ span {
opacity:;
}
</style>
:read-only 伪类选择器用来指定处于只读状态元素的样式。简单点理解就是,元素中设置了“readonly=’readonly’
:read-write 选择器刚好与“:read-only”选择器相反,主要用来指定当元素处于非只读状态时的样式。
<form action="#">
<div>
<label for="name">姓名:</label>
<input type="text" name="name" id="name" placeholder="大漠" />
</div>
<div>
<label for="address">地址:</label>
<input type="text" name="address" id="address" placeholder="中国上海" readonly="readonly" />
</div>
</form>
 <style>
form {
width: 300px;
padding: 10px;
border: 1px solid #ccc;
margin: 50px auto;
}
form > div {
margin-bottom: 10px;
} input[type="text"]{
border: 1px solid orange;
padding: 5px;
background: #fff;
border-radius: 5px;
} input[type="text"]:-moz-read-only{
border-color: #ccc;
}
input[type="text"]:read-only{
border-color: #ccc;
}
input[type="text"]:-moz-read-write{
border-color: #f36;
}
input[type="text"]:read-write{
border-color: #f36;
}
</style>

::selection 伪元素是用来匹配突出显示的文本
::selection {
background: red;
color: green;
}
::before和::after这两个主要用来给元素的前面或后面插入内容,这两个常和"content"配合使用,使用的场景最多的就是清除浮动。
<style>
.clearfix::before,
.clearfix::after {
content: ".";
display: block;
height:;
visibility: hidden;
}
.clearfix:after {clear: both;}
.clearfix {zoom:;}
</style>

css3选择器二的更多相关文章

  1. CSS3选择器(二)--表单

    :enabled 选择可用状态的表单元素 :disabled 选择不可用状态的表单元素 :checked 复选框.单选框选中状态的选项 ::selection 用来匹配突出显示的文本(用鼠标选择文本时 ...

  2. css3 选择器(二)

    接css3选择器(一) 八.结构性伪类选择器[:nth-child(n)] :nth-child(n)选择器用来匹配某个父元素的一个或多个特定的子元素,和jquery中一样. 其中"n&qu ...

  3. CSS3知识点整理(二)----CSS3选择器

    总结各种CSS3选择器的介绍及具体语法 (一)属性选择器 在CSS2中引入了一些属性选择器,而CSS3在CSS2的基础上对属性选择器进行了扩展,新增了3个属性选择器,使得属性选择器有了通配符的概念,这 ...

  4. css3的那些高级选择器二

    在上个星期我介绍了css3的属性选择器,伪类选择器和结构伪类选择器,今天楼主继续把其它的css3选择器说完. 在css3中,共有11中UI状态伪类选择器,分别是E:hover,E:active,E:f ...

  5. CSS3选择器(二)之属性选择器

    CSS3选择器的第二部分——属性选择器.. 属性选择器早在CSS2中就被引入了,其主要作用就是对带有指定属性的HTML 元素设置样式 使用CSS3属性选择器,你可以只指定元素的某个属性,或者你还可以同 ...

  6. CSS3 选择器——属性选择器

    上一节在<CSS3选择器——基本选择器>中主要介绍了CSS3选择器的第一部分,这节主要和大家一起来学习CSS3选择器的第二部分——属性选择器.属性选择器早在CSS2中就被引入了,其主要作用 ...

  7. css3 选择器(三)

    接css3选择器(一) 接css3 选择器(二) 这篇和前两篇内容相关性不大,主要是涉及到一些css3的状态选择器,所以标题从一开始. 一.[:enabled]选择器 一看这个属性就知道是专为表单元素 ...

  8. CSS3 选择器——基本选择器

    CSS的选择器,我想大家并不会陌生吧,因为天天在使用,但对于CSS3的选择器,要运用的灵活到位,我想对很多朋友还是一定的难度,特别是CSS3中的:nth选择器.那么从现在开始我们先丢开他们版本的区别, ...

  9. css3选择器(一)

    直接开始正文. 一.css3同级元素通用选择器[update20161228] 选择器:E~F 匹配任何在E元素之后的同级F元素 Note:E~F选择器选中的是E元素后面同级元素中的全部F元素. 例: ...

随机推荐

  1. i = i++;

    在这里jvm里面有两个存储区,一个是暂存区(是一个堆栈,以下称为堆栈),另一个是变量区.语句istore_1是将堆栈中的值弹出存入相应的变量区(赋值):语句iload_1是将变量区中的值暂存如堆栈中. ...

  2. Algernon's Noxious Emissions POJ1121 zoj1052

    One of the greatest alchemists of the lower Middle Renaissance, Algernon da Vinci (one of Leonardo's ...

  3. 最小K个数之和

    描述 输入n个整数,输出其中最小的K个数之和.例如输入4,5,1,1,6,2,7,3,3这9个数字,当k=4,则输出最小的4个数之和为7(1,1,2,3). 输入 测试样例组数不超过10 每个测试案例 ...

  4. jquery中ajax向action传递对象参数,json ,spring注入对象

    首先,我这个程序的框架是spring+struts2+hibernate. 后端的action的需要接受从前端传进来的参数,由spring的注入,可知,如果前端用的是form的话,只需要在每个inpu ...

  5. ORACLE时间函数(SYSDATE)深入理解

    ORACLE时间函数(SYSDATE)深入理解 加法 select sysdate,add_months(sysdate,12) from dual; --加1年 select sysdate,add ...

  6. poj 2104 划分树

    思路:裸的划分树 #include<iostream> #include<algorithm> #include<cstring> #include<cstd ...

  7. 实现TableLayout布局下循环取出TableRow控件中的文字内容到list集合

    布局方式为TableLayout,利于实现表单样式展现. <!-- 详情内容区域 --> <ScrollView android:layout_above="@id/id_ ...

  8. 【转】移动互联网应用测试成长技能树V1.0

  9. Bootstrap之Footer页尾布局(2015年05月28日)

    直接上页尾部分的代码: <!--采用container-fluid,使得整个页尾的宽度为100%,并设置它的背景色--><footer class="container-f ...

  10. 常用经典SQL语句大全(技巧)

    三.技巧 1.1=1,1=2的使用,在SQL语句组合时用的较多 “where 1=1” 是表示选择全部    “where 1=2”全部不选, 如: if @strWhere !='' begin s ...