css 选择器

读书笔记,稍后整理~~

#main <div> p: This expression finds an element with an ID of main, all <div> element

descendants, and then all <p> element descendants. All of this is a proper CSS 1 selector.


div.items > p: This expression finds all <div> elements that have a class of items, then

locates all child <p> elements. This is a valid CSS 2 selector.


div:not(.items): This locates all <div> elements that do not have a class of items. This is

a valid CSS 3 selector.


cssLibrary  VS Jquery

cssLibrary : http://dean.edwards.name

// Find all <p> children of <div> elements
cssQuery("div > p");

// Find all <div>s, <p>s, and <form>s
cssQuery("div,p,form");

// Find all <p>s and <div>s then find all <a>s inside of them
var p = cssQuery("p,div");
cssQuery("a",p);

// Find all <div>s that have a class of 'links' and a <p> element inside of them
$("div.links[p]")
// Find all descendants of all <p>s and <div>s
$("p,div").find("*")
// Find every other link that points to Google
$("a[@href^='google.com']:even")


对于纯XML文件的导航来说,可以使用XPATH替代CSS选择器


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值