{"id":14172,"date":"2011-09-06T19:55:35","date_gmt":"2011-09-07T02:55:35","guid":{"rendered":"http:\/\/css-tricks.com\/?page_id=14172"},"modified":"2015-03-27T08:26:27","modified_gmt":"2015-03-27T15:26:27","slug":"disabled","status":"publish","type":"page","link":"https:\/\/css-tricks.com\/almanac\/selectors\/d\/disabled\/","title":{"rendered":":disabled"},"content":{"rendered":"

The :disabled<\/code> pseudo-class selector provides conditional styling to HTML elements that can receive user input, when the elements have the disabled<\/code> attribute. It is defined in the CSS Selectors Level 3 spec<\/a> as a \u201cUI element state pseudo-class\u201d, meaning it is used to style content based on the user’s interaction with an input element.<\/p>\n

Elements that can receive the disabled<\/code> attribute include <button><\/code>, <input><\/code>, <textarea><\/code>, <optgroup><\/code>, <option><\/code> and <fieldset><\/code>. There are two valid syntaxes for setting this attribute: either disabled=\"disabled\"<\/code> or (in HTML5) simply the disabled<\/code> Boolean keyword. An element is disabled if it can’t be activated (e.g. selected, clicked on or accept text input) or accept focus.<\/p>\n

Such an element can be styled using the :disabled<\/code> pseudo-class selector:<\/p>\n

<\/code>Check out this Pen!<\/a><\/pre>\n

Points of Interest<\/h3>\n