{"id":14248,"date":"2011-09-06T20:26:51","date_gmt":"2011-09-07T03:26:51","guid":{"rendered":"http:\/\/css-tricks.com\/?page_id=14248"},"modified":"2021-04-12T08:13:43","modified_gmt":"2021-04-12T15:13:43","slug":"out-of-range","status":"publish","type":"page","link":"https:\/\/css-tricks.com\/almanac\/selectors\/o\/out-of-range\/","title":{"rendered":":out-of-range"},"content":{"rendered":"\n
The I believe it’s only relevant on The selector is defined in the Selectors Level 4 specification<\/a>, alongside its counterpart, Just like the code above, this input will have a green border when its value is between 5 and 10.<\/p>\n\n\n\n <\/p>\n\n\n:out-of-range<\/code> pseudo selector in CSS matches input elements when their value is outside the range specified as being acceptable.<\/p>\n\n\n\n
<input max=\"10\" min=\"5\" type=\"number\"><\/code><\/pre>\n\n\n\n
input:out-of-range {\n border: 5px solid red;\n}<\/code><\/pre>\n\n\n\n
input[type=number]<\/code>. Range inputs don’t allow values outside their min\/max and it doesn’t make much sense on any other type of input. Perhaps text-y inputs with a
max<\/code> length, but the behavior on those in most browsers is to prevent entry past the max anyway.<\/p>\n\n\n\n
:in-range<\/a><\/code>.<\/p>\n\n\n
Demo<\/h4>\n\n\n
Browser support<\/h3>\n\n