CSS“和"和“或" [英] CSS "and" and "or"

查看:23
本文介绍了CSS“和"和“或"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我遇到了很大的麻烦,因为我需要对某些输入类型进行样式化处理.我有类似的东西:

I've got quite big trouble, because i need to anathematise from styling some input types. I had something like:

.registration_form_right input:not([type="radio")
{
 //Nah.
}

但我也不想为复选框设置样式.

But i don't want to style checkboxes too.

我试过了:

.registration_form_right input:not([type="radio" && type="checkbox"])
.registration_form_right input:not([type="radio" && "checkbox"])
.registration_form_right input:not([type="radio") && .registration_form_right input:not(type="checkbox"])

如何使用&&?而且我很快就需要使用 ||,而且我认为用法会一样.

How to use &&? And I'll need to use || soon, and I think that usage will be same.

更新:
我仍然不知道如何正确使用 ||&&.我在 W3 文档中找不到任何内容.

Update:
I still don't know how to use || and && correctly. I couldn't find anything in W3 docs.

推荐答案

&& 像这样将多个选择器串在一起工作:

&& works by stringing-together multiple selectors like-so:

<div class="class1 class2"></div>

div.class1.class2
{
  /* foo */
}

另一个例子:

<input type="radio" class="class1" />

input[type="radio"].class1
{
  /* foo */
}

|| 通过使用逗号分隔多个选择器来工作:

|| works by separating multiple selectors with commas like-so:

<div class="class1"></div>
<div class="class2"></div>

div.class1,
div.class2
{
  /* foo */
}

这篇关于CSS“和"和“或"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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