Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The font is not displayed if I use a reset rule: body * { font-family: sans-serif !important; } #1716

Closed
matih opened this issue Aug 4, 2013 · 6 comments

Comments

@matih
Copy link

matih commented Aug 4, 2013

In previous version (I don't know which, because the version number is missing in the css) - the font-family rule was applied more specific, on the :before selector :
[class^="icon-"]:before,[class*=" icon-"]:before { font-family: 'FontAwesome';

But now it's applied on the class selector:
class^="icon-"],[class*=" icon-"] { font-family: FontAwesome;
and cause a conflict with global reset rules that override the less specific rules.

@tagliala
Copy link
Member

tagliala commented Aug 4, 2013

@kruszczynski
Copy link

Let's think what your !important css code does. It says - overwrite the font to sans-serif everywhere. This is a brute force solution and shouldn't be used.

However sometimes one doesn't want to code beautifully, one wants to get the job done no matter what, not caring about code beauty. Then you might try modifying Font Awesome's css to say font-family: 'FontAwesome' !important;. This should work, however it's quite an ugly code.

@matih
Copy link
Author

matih commented Aug 5, 2013

I agree, I used this rule because I used an external theme and I made custom changes that needed to force and override all theme rules.

But, why not leave the font-family rule on the :before selector like the previous version??

@kruszczynski
Copy link

That's an interesting question.

I quickly looked through change logs and Github Milestones but found nothing. I guess there was a reason to get rid of :before.

My guesses would be to do with wide animation support, or some other compatibility issue.

Maybe someone knows :)

Did you try modifying Font Awesome's css?

@matih
Copy link
Author

matih commented Aug 5, 2013

Without an other option I added the old rule to my CSS (not Font Awesome's CSS):
[class^="icon-"]:before,[class*=" icon-"]:before { font-family: 'FontAwesome'; }

VonC added a commit to VonC/Font-Awesome that referenced this issue Oct 10, 2013
When Font-Awesome is used with other third-party css framework,
like https://github.com/hakimel/reveal.js, said css framework
can define (wrongly or rightly) global rule like
https://github.com/hakimel/reveal.js/blob/master/css/reveal.css#L16
that end up overriding font-awesome.css rules.

And that, even if font-awesome.css is declared _after_ all other css.

Restoring that font-family in the :before selector ensure that rule
is present in the final css rules applied to an html element.

Similar to FortAwesome#1716
@tagliala
Copy link
Member

Closing here, please use custom css if you have a similar issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants