Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Square brackets in CSS [duplicate]

Tags:

html

css

forms

What does it mean when something between square brackets in CSS? E.g.

input[type="radio"]

like image 361
Alexander Reich Avatar asked Apr 16 '13 15:04

Alexander Reich


2 Answers

It's an attribute selector in CSS

E[foo="warning"] Matches any E element whose "foo" attribute value is exactly equal to "warning".

more on http://www.w3.org/TR/CSS2/selector.html

like image 67
Robert Avatar answered Sep 16 '22 16:09

Robert


Square brackets are attribute selector syntax.

Your (complete) example means "Select elements of type input which have a type attribute with the value radio" e.g. <input type="radio">

like image 45
Quentin Avatar answered Sep 18 '22 16:09

Quentin