0

Today I saw this and wondered why the class names were wrapped in brackets. The class names in the CSS do not have the brackets. Do the brackets offer any benefit?

<svg class="[ icon ] [ fancy-link__icon ]"...

Which had this accompanying CSS:

.fancy-link__icon {
  font-size: 1.5em;
}
.icon {
  width: 1em;
  height: 1em;
}
UXCODA
  • 1,118
  • 2
  • 18
  • 33
  • Duplicate of [What is the reason to have (square) brackets in an element's class name?](https://stackoverflow.com/questions/29718520/what-is-the-reason-to-have-square-brackets-in-an-elements-class-name) – UXCODA Mar 14 '19 at 22:11
  • 2
    You may also mind the notes of this answer https://stackoverflow.com/questions/3483391/what-do-square-brackets-in-class-names-mean#37721335 *(if you escape the brackets, you might select them as classnames : `.\[ {/*style*/}` ) – G-Cyrillus Mar 14 '19 at 22:30

0 Answers0