Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

what do square brackets within a css style do?

Tags:

css

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;]
}
like image 662
Rob Y Avatar asked Apr 30 '13 18:04

Rob Y


People also ask

What does square brackets mean in CSS?

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.

What is the point of square brackets?

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.

How do you make a square bracket in CSS?

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'.


1 Answers

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.

like image 76
Rich Bradshaw Avatar answered Jan 04 '23 01:01

Rich Bradshaw