Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What should be the generic font family for Font-Awesome fonts?

I'm using FontAwesome 4.7 in one of my project and we have SonarQube integration. At few places in my custom CSS files, I've to provide Font-Family manually like:

.calendar-wrapper:after {
  font-family: 'FontAwesome';
  content: '\f073';
  position: absolute;
  right: 9px;
  top: 9px;
}

But at this line, SonarQube shows me bug: Unexpected missing generic font family (Rule Here)

What should be the generic font-family for FontAwesome? I looked everywhere on the internet but didn't found any solution yet.

like image 725
Faizan Saiyed Avatar asked Nov 27 '25 22:11

Faizan Saiyed


2 Answers

'FontAwesome' is a custom font, so sonarqube is asking to add generic font to fallback to. Adding a generic font like "sans-serif" will be sufficinet.

.calendar-wrapper:after {
  font-family: 'FontAwesome', sans-serif;
  content: '\f073';
  position: absolute;
  right: 9px;
  top: 9px;
}
like image 58
Durga Prasad Avatar answered Nov 30 '25 12:11

Durga Prasad


Based on the official documentation, you need to have a generic font in your font and font-family values. Generic fonts means serif or sans-serif and they works a fallback fonts in case the main font is not reachable which could be because of some privacy settings on user's browser.

Please check the official documentation here: https://stylelint.io/user-guide/rules/list/font-family-no-missing-generic-family-keyword/

like image 26
Mostafa Ahangarha Avatar answered Nov 30 '25 12:11

Mostafa Ahangarha



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!