CSS:多重属性选择 [英] CSS: multiple attribute selector

查看:198
本文介绍了CSS:多重属性选择的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

什么是做这样的事情。

input[name="Sex" AND value="M"]

基本上我只是想有两个属性名称=性行为的输入元素,它必须和值=M。元素,如<输入类型=电台NAME =性价值=F/方式> 不应该选择

推荐答案

简单输入[名称=性别] [值= M] 会做pretty不错。 ),它实际上在标准DOC 很好的描述:

Simple input[name=Sex][value=M] would do pretty nice. ) And it's actually well-described in the standard doc:

多个属性选择可以用来指数
  一个元素的属性,甚至多次以相同的属性。

Multiple attribute selectors can be used to refer to several attributes of an element, or even several times to the same attribute.

下面,选择所有SPAN元素,其你好属性相匹配
  正好有值骑士和他的再见属性有
  究竟值哥伦布

Here, the selector matches all SPAN elements whose "hello" attribute has exactly the value "Cleveland" and whose "goodbye" attribute has exactly the value "Columbus":

跨度[你好=克利夫兰] [再见=哥伦布] {颜色:蓝色; }

一点题外话,使用属性值左右引号只有当这个值不是一个有效的标识符必需的。

As a sidenote, using quotation marks around an attribute value is required only if this value is not a valid identifier.

演示

这篇关于CSS:多重属性选择的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆