I'm editing a site I inherited and I see a css syntax I don't recognize.
Has anyone ever seen this syntax before? What do the square brackets within a style mean?
Thanks, Rob
.trigger-txt-left {
color: #0455A3;
font-family: 'OpenSans';
float: left;
font-size: 16px;
font-weight: bolder;
width: 235px;
[font-family: 'OpenSans';
font-family: 'HelveticaNeue-Bold';]
[font-weight: bolder;
font-weight: normal;]
}
The square brackets are used as an attribute selector, to select all elements that have a certain attribute value. In other words, they detect attribute presence.
Square brackets (also called brackets, especially in American English) are mainly used to enclose words added by someone other than the original writer or speaker, typically in order to clarify the situation: He [the police officer] can't prove they did it.
Square brackets are attribute selector syntax. Show activity on this post. The selector you've given in the question means it would need all three words: The element name 'input', the attribute 'type' and the value for that attribute being 'radio'.
The short answer is, nothing. They aren't valid CSS.
Speculating though, perhaps the person was using some code to choose the right one somewhere else, for instance, some PHP might be reading this, then parsing out the [
and ]
and then selecting the correct property.
Alternatively they might not have realised to use the /* */
style comments, or perhaps they thought they were being clever by ensuring it wasn't valid in that way.
More likely though it's a mistake, possibly copy and pasted from somewhere.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With