zoukankan      html  css  js  c++  java
  • (3)选择元素——(6)属性选择器(Attribute selectors)

    Attribute selectors are a particularly helpful subset of CSS selectors. They allow us to specify an element by one of its HTML attributes, such as a link's title attribute or an image's alt attribute. 

    属性选择器是一个相当有用css选择器的子集。 它允许我们通过一个元素的html属性去明确一个元素,比如一个链接的title属性或者一个图片的alt属性。
    For example, to select all images that have an alt attribute, we write the following:$('img[alt]')Attribute selectors accept a wildcard syntax inspired by regular expressions for identifying the value at the beginning (^) or ending ($) of a string.  They can also take an asterisk (*) to indicate the value at an arbitrary position within a string or an exclamation mark (!) to indicate a negated value.
    比如,为了选择所有有着alt属性的的图片,我们写下下面的$("img[alt]")属性选择器,接受一个使用有规则的表达式的通配符语法用来明确一个字符串开始(^)和结束($)的值。 他们也可以使用星号(*)去表明在某一个位置有某个值,或者使用叹号(!)去表明一个相反的值。
  • 相关阅读:
    乱谈服务器编程
    set global slow_query_log引起的MySQL死锁
    一个由string使用不当产生的问题
    Hbase初体验
    浅谈SQLite——查询处理及优化
    ACID、Data Replication、CAP与BASE
    libevent源码分析
    浅析Linux Native AIO的实现
    vim7.2中文乱码解决方法
    伸展树的点点滴滴
  • 原文地址:https://www.cnblogs.com/pangblog/p/3339575.html
Copyright © 2011-2022 走看看