일부 입력 유형을 스타일링하여 분석해야하기 때문에 상당히 큰 문제가 있습니다. 나는 다음과 같은 것을 가지고 있었다.
.registration_form_right input:not([type="radio")
{
//Nah.
}
하지만 체크 박스에 스타일을 지정하고 싶지도 않습니다.
난 노력 했어:
.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"])
사용하는 방법 &&
? 그리고 ||
조만간 사용해야하는데 사용법도 같을 것 같아요.
업데이트 :
난 아직도 사용하는 방법을 알고하지 않습니다 ||
및 &&
올바르게. W3 문서에서 아무것도 찾을 수 없습니다.
답변
&&
여러 선택기를 함께 묶어 작동합니다.
<div class="class1 class2"></div>
div.class1.class2
{
/* foo */
}
다른 예시:
<input type="radio" class="class1" />
input[type="radio"].class1
{
/* foo */
}
||
여러 선택기를 쉼표로 구분하여 작동합니다.
<div class="class1"></div>
<div class="class2"></div>
div.class1,
div.class2
{
/* foo */
}
답변
그리고 ( &&
) :
.registration_form_right input:not([type="radio"]):not([type="checkbox"])
또는 ( ||
) :
.registration_form_right input:not([type="radio"]),
.registration_form_right input:not([type="checkbox"])
답변
요소 의 속성 a
AND 를 선택하려면 :b
X
X[a][b]
요소 의 속성 a
또는 속성을 선택하려면 :b
X
X[a],X[b]
답변
:not
의사 – 클래스는 IE에서 지원하지 않습니다. 대신 이와 같은 것을 얻었습니다.
.registration_form_right input[type="text"],
.registration_form_right input[type="password"],
.registration_form_right input[type="submit"],
.registration_form_right input[type="button"] {
...
}
일부 중복되지만 더 높은 호환성을 위해 지불하는 것은 적은 비용입니다.
답변
& 및 : not을 사용하여 “OR”의 동작을 어떻게 든 재현 할 수 있습니다.
SomeElement.SomeClass [data-statement="things are getting more complex"] :not(:not(A):not(B)) {
/* things aren't so complex for A or B */
}
답변
더 많은 선택자를 작성하고 쉼표로 나누는 것을 싫어합니까?
.registration_form_right input:not([type="radio"]),
.registration_form_right input:not([type="checkbox"])
{
}
그리고 BTW이
not([type="radio" && type="checkbox"])
“이 두 가지 유형이없는 입력”처럼 보입니다. 🙂
답변
만약 누군가가 나처럼 붙어 있다면. 포스트와 약간의 타격과 재판을 거친 후에 이것은 나를 위해 일했습니다.
input:not([type="checkbox"])input:not([type="radio"])