Closed. This question needs
In this picture, does '-' act in a way that connects between id? or the entire 'fa-facebook' is an id?
CodePudding user response:
The entire fa-facebook is the class. Easier to read than faFacebook.
CodePudding user response:
Hyphens are valid characters in CSS class names, so fa-facebook
is one single class name.
A lot of libraries (in this case Font Awesome) use a prefix like this as a namespace mechanism, to prevent clashing with user-defined class names.
This answer does a very good job at explaining what constitutes a valid CSS class name.
CodePudding user response:
From the specification:
The attribute, if specified, must have a value that is a set of space-separated tokens representing the various classes that the element belongs to.
So, the -
is a token part (or class identifier).
CodePudding user response:
fa-facebook
is a class But you can add your own class to add style or anything.
Basically fa-facebook
is for any CDN class but If your change as your own style the CDN style may be changed. So it will be good to add new class or Id.
CodePudding user response:
"-" uses to separate the word.It increases the readability of the identifuer by separating the words by hyphen.But that is not a rule , it's a best practice .As per your question , fa-facebook is the entire class name (identifier). faFacebook or fa_facebook are also valid. But if you write it as two words by separating spaces (fa facebook , then that identify as two classes.
CodePudding user response:
The fa-facebook represents a single class name and fafacebook is also a valid class name but the earlier one is easy to read.