問題描述
我想為輸入元素應用一些 css,并且我只想對未禁用且非提交類型的輸入執行此操作,下面的 css 不起作用,也許如果有人可以解釋我必須如何添加它.
I want to apply some css for inputs elements and I want to do that only for inputs that are not disabled and are not submit type, below css is not working, maybe if someone can explain me how this must be added .
input:not(disabled)not:[type="submit"]:focus{
box-shadow:0 0 2px 0 #0066FF;
-webkit-box-shadow:0 0 4px 0 #66A3FF;
}
推薦答案
代替:
input:not(disabled)not:[type="submit"]:focus {}
用途:
input:not([disabled]):not([type="submit"]):focus {}
disabled
是一個屬性,因此它需要括號,并且您似乎在 :not()
選擇器上混淆了/缺少冒號和括號.
disabled
is an attribute so it needs the brackets, and you seem to have mixed up/missing colons and parentheses on the :not()
selector.
演示:http://jsfiddle.net/HSKPx/
需要注意的一點:我可能是錯的,但是我不認為 disabled
輸入可以正常接收焦點,所以那部分可能是多余的.
One thing to note: I may be wrong, but I don't think disabled
inputs can normally receive focus, so that part may be redundant.
或者,使用 :enabled
input:enabled:not([type="submit"]):focus { /* styles here */ }
再次,我想不出禁用輸入可以接收焦點的情況,因此似乎沒有必要.
Again, I can't think of a case where disabled input can receive focus, so it seems unnecessary.
這篇關于Css 偽類 input:not(disabled)not:[type="submit"]:focus的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!