属性选择器,字面意思就是根据标签中的属性,选中当前的标签。

属性选择器 通常在表单控件中 使用比较多

根据属性查找

/*用于选取带有指定属性的元素。*/
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="x-ua-compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Title</title>
<style type="text/css">
label[for]{
color: red;
}
</style> </head>
<body>
<div>
<form>
<div>
<label for="user">用户名</label>
<input type="text" id="user">
</div> </form>
</div>
</body>
</html>

根据属性和值查找

/*用于选取带有指定属性和值的元素。*/
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="x-ua-compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Title</title>
<style type="text/css">
label[for="user"]{
color: red;
}
</style> </head>
<body>
<div>
<form>
<div>
<label for="user">用户名</label>
<input type="text" id="user">
</div> </form>
</div>
</body>
</html>

表单常用

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="x-ua-compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Title</title>
<style type="text/css">
input[type="text"]{
color: red;
}
</style> </head>
<body>
<div>
<form>
<div>
<label for="user">用户名</label>
<input type="text" id="user">
</div> </form>
</div>
</body>
</html>

最新文章

  1. idea fect
  2. CentOS 7 学习笔记(一)时间管理
  3. scikit-learn一般实例之一:绘制交叉验证预测
  4. SQL Server基础知识
  5. JavaScript使用XMLHttpRequest 發送GET/Post 請求
  6. afx , afxMessageBox , MessageBox
  7. Maven打jar包
  8. Java-马士兵设计模式学习笔记-总结
  9. mybatis 中mapper 的namespace有什么用
  10. bzoj 3932 [CQOI2015]任务查询系统(主席树)
  11. Android 开发笔记 “Sqlite数据库删除”
  12. CPU卡
  13. vue-过滤器filter
  14. SmartSql V3 重磅发布
  15. Elasticsearch 通关教程(四): 分布式工作原理
  16. learning websocket protocol
  17. .Net使用Redis详解之ServiceStack.Redis(七) 转载https://www.cnblogs.com/knowledgesea/p/5032101.html
  18. day 7-6 多线程及开启方式
  19. Android触摸事件(一)-TouchEventHelper
  20. django-registration

热门文章

  1. 010-流程控制 while 与 until 语句
  2. AtCoder Regular Contest 092 Two Sequences AtCoder - 3943 (二进制+二分)
  3. 算法学习 howto
  4. Insomni&#39;hack teaser 2019 - Pwn - 1118daysober
  5. const定义的并非是常量,而是常量索引
  6. IP地址转二进制
  7. Arduino-LiquidCrystal_I2C 液晶库
  8. 微信小程序-wxml-空格
  9. mysql Update语句 语法
  10. [转]Vue项目全局配置微信分享思路详解