The jQuery library supports nearly all of the selectors included in CSS specifications 1 through 3, as outlined on the World Wide Web Consortium's site: http://www.w3.org/Style/CSS/specs. This support allows developers to enhance their websites without worrying about which browsers (particularly Internet Explorer 6) might not understand advanced selectors, as long as the browsers have JavaScript enabled.

jquery支持几乎所有的css1到3的规范,在世界万维网协会网站http://www.w3.org/Style/css/specs有一个概述。这份支持允许开发者扩展他们的网站,而不用担心这是哪一个浏览器(尤其是IE6)或许不懂高级选择器,只要浏览器支持js脚本就行。

Progressive enhancement
Responsible jQuery developers should always apply the concepts of progressive enhancementand graceful degradationto their code, ensuring that a page will render as accurately, even if not as beautifully, with JavaScript disabled as it does with JavaScript turned on. We will continue to explore these concepts throughout the book.

渐进增强
有责任感的jquery开发者应该总是应用渐进增强和优雅降级的概念到自己代码中,确保这个网页将会精确的渲染,即使在js被禁用后不是像启用js后的那么漂亮。我们将在整本书中继续探索这个概念。

To begin learning how jQuery works with CSS selectors, we'll use a structure that appears on many websites, often for navigation: the nested, unordered list:

<ul id="selected-plays">
<li>Comedies
<ul>
<li><a href="/asyoulikeit/">As You Like It</a></li>
<li>All's Well That Ends Well</li>
<li>A Midsummer Night's Dream</li>
<li>Twelfth Night</li>
</ul>
</li>
<li>Tragedies
<ul>
<li><a href="hamlet.pdf">Hamlet</a></li>
<li>Macbeth</li>
<li>Romeo and Juliet</li>
</ul>
</li>
<li>Histories
<ul>
<li>Henry IV (<a href="mailto:henryiv@king.co.uk 
">email</a>)
<ul>
<li>Part I</li>
<li>Part II</li>
</ul>

<li><a href="http://www.shakespeare.co.uk/henryv.htm">

Henry V
</a></li>
<li>Richard II</li>
</ul>
</li>
</ul>

为了开始学习jquery如何使用css选择器工作,我们将使用在很多网站上出现的结构,通常是导航,一个嵌套的无序的列表:(代码如上)

Notice that the first <ul>has an ID of selected-plays, but none of the <li>tags have a class associated with them. Without any styles applied, the list looks similar to the following screenshot:

注意到第一个ul标签有一个selected-play ID,但是任何一个li标签上都没有类。在没有任何样式的情况下,这个列表看起来就像下面的截图一样。

这个嵌套的列表现实的好像我问期望他是一系列元素垂直排列,然后根据级别缩进。

(3)选择元素——(4)css选择器(CSS selectors)的更多相关文章

  1. 前端CSS css引入方式 css选择器 css选择器优先级

    一.       CSS介绍 CSS(Cascading Style Sheet,层叠样式表)定义如何显示HTML元素,给HTML设置样式,让它更加美观. 当浏览器读到一个样式表,它就会按照这个样式表 ...

  2. [css选择器]总结:IE6不支持的CSS选择符

    转载地址:https://www.wenjiwu.com/doc/zvsbii.html.此文最后也给出了原文地址,但是我点击过去发现是什么赌博彩票的地址,360也弹出小心的提示,所以这里只给出了我转 ...

  3. css selector regexp css选择器 正则表达式 css 参考手册

    jQuery 选择元素  a.text-success, a.text-danger, a.text-primary, a.text-info $("a[class^=text-]" ...

  4. 细说CSS选择器

    众所周知,CSS的一个核心特征就是能向文档中的一组元素类型应用某些规则.每个规则都有两个基本部分:选择器(selector)和声明块(declaration block).下图显示了规则的各个部分. ...

  5. 【CSS】使用CSS选择器

    CCS选择器的作用是找出某类元素.以便使我们使用style元素或者外部样式表对这类元素设置样式. 1.使用CSS基本选择器 有些选择器使用起来非常简单,我们把这部分选择器称为基本选择器(basic s ...

  6. CSS 选择器汇总

    CSS 选择器 CSS 元素选择器 CSS 选择器分组 CSS 类选择器详解 CSS ID 选择器详解 CSS 属性选择器详解 CSS 后代选择器 CSS 子元素选择器 CSS 相邻兄弟选择器 CSS ...

  7. CSS选择器,CSS3选择器

    CSS选择器 ------->CSS选择器优先级 1>通配符选择器(CSS2) 选择所有元素,所有浏览器都支持. *{ margin:0; padding:o; } 2>元素选择器( ...

  8. 【前端学习】【CSS选择器】

    CSS选择器     CSS选择器 CSS(Cascading Style Sheets)是一项出色的技术,它使得网页的结构和表现样式完全分离.利用CSS选择器能轻松地对某个元素添加样式而不改动HTM ...

  9. python 全栈开发,Day46(列表标签,表格标签,表单标签,css的引入方式,css选择器)

    一.列表标签 列表标签分为三种. 1.无序列表<ul>,无序列表中的每一项是<li> 英文单词解释如下: ul:unordered list,“无序列表”的意思. li:lis ...

随机推荐

  1. OpenCV---图片生成视频

    /** It is a batch processing interface. */ #include "stdafx.h" #include <windows.h> ...

  2. CodeForces 452C Magic Trick (排列组合)

    #include <iostream> #include <cstdio> #include<cmath> #include<algorithm> us ...

  3. C#复习三(Day 22)

    哈哈,又到了总结的时间了.今天还是在继续复习C#的基础语法.这次总结主要以一下小程序为主. Split()的运用 123-456---789-----123-2把类似的字符串中重复符号去掉,得到123 ...

  4. (转)原子操作 Interlocked系列函数

    上一篇<多线程第一次亲密接触 CreateThread与_beginthreadex本质区别>中讲到一个多线程报数功能.为了描述方便和代码简洁起见,我们可以只输出最后的报数结果来观察程序是 ...

  5. Ajax学习之小结

    ajax: * 同步交互和异步交互:  * 同步交互:客户端发送请求——>等待服务器端处理——>接收响应,这个过程客户端不能做任何其他事情,这种模式叫做同步交互  * 异步交互:客户端发送 ...

  6. 第二天(CSS 选择器)

    1.常用的CSS选择器         类型选择器: 例如: p { color : red ; }         后代选择器: 例如: h2 span { font-weight : bold ; ...

  7. C#数据库——用多线程来组合一个SQL语句

    StringBuffer sql = new StringBuffer();或(StringBuilder sql = new StringBuilder ()) sql.Append("s ...

  8. appium 学习各种小功能总结--功能有《滑动图片、保存截图、验证元素是否存在、》---新手总结(大牛勿喷,新手互相交流)

    1.首页滑动图片点击 /** * This Method for swipe Left * 大距离滑动 width/6 除数越大向左滑动距离也越大. * width:720 *height:1280 ...

  9. Spring Boot Logback应用日志

    e Spring Boot Logback应用日志 2015-09-08 19:57 7673人阅读 评论(0) 收藏 举报 . 分类: Spring Boot(51) . 目录(?)[+] 日志对于 ...

  10. Strata 2014 上的 AzureCAT 粉笔会谈

     本周,AzureCAT 团队非常高兴在 Strata 会议上首次集体亮相.对于那些对 AzureCAT 团队不太熟悉的人来说,我们是 Microsoft 云与企业部门一个核心的国际性团队,由大约 ...