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

Restore font-family to :before selector. #2131

Closed
wants to merge 1 commit into from

Conversation

VonC
Copy link

@VonC VonC commented 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 #1716

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

I'm really against this one, people using that framework should fix by themselves.

I have to close this one because pull requests should have be done against w.i.p branches.

With the new 4.0.0 syntax, the fix should be

.reveal .fa-icon {
  font-family: 'FontAwesome';
}

@davegandy @robmadole thoughts ?

PS: CSS is automatically generated from LESS (that is automatically generated by jekyll 😆). In other words, source files are in https://github.com/FortAwesome/Font-Awesome/blob/4.0.0-wip/src/assets/font-awesome/less/ and their SCSS counterpart.

@tagliala tagliala closed this Oct 10, 2013
@tagliala tagliala reopened this Oct 10, 2013
@VonC
Copy link
Author

VonC commented Oct 11, 2013

@tagliala I have no problem with this pull-request being closed.

It was more a candid feedback than anything else:

I am using Font-Awesome with reveal.js; it doesn't work.
I restore font-family in the :before selector, it works".

I will now have a closer look at reveal.js use of font-family:inherited for html and body in reveal.js css 😉

@tagliala
Copy link
Member

the problem is that .reveal * stuff has priority over *[class^=icon-]
E.g: http://jsfiddle.net/tagliala/Ea4fB/1/

To fix the current version add to your stylesheets:

.reveal [class^="icon-"],
.reveal [class*=" icon-"] {
  font-family: 'FontAwesome';
}

E.g: http://jsfiddle.net/tagliala/Ea4fB/2

@VonC
Copy link
Author

VonC commented Oct 11, 2013

@tagliala Thank you very much. It seems to work fine, both with fa 3.2.1 and wip-4.0.0:

I included:

    <style type="text/css">
      .reveal [class^="fa-icon-"],
      .reveal [class*=" fa-icon-"],
      .reveal [class^="icon-"],
      .reveal [class*=" icon-"]  {
        font-family: 'FontAwesome';
      }

And try (with FA 4.0.0) a:

<i class="fa-icon-twitter"></i>Test

It works well, without having to modify anything in hakimel/reveal.js

That kind of setting would be interesting to know when reading the "Not using Bootstrap?" of the Get Started page

@tagliala
Copy link
Member

@VonC you're welcome

btw in fa 4.0.0 the proper usage is fa-icon fa-icon-icon, it should not work otherwise because all basic styles are applied to fa-icon class...

@tagliala tagliala closed this Oct 11, 2013
@tagliala
Copy link
Member

@VonC

I read better your css. It's "wrong", please fix with:

.reveal .fa-icon,
.reveal [class^="icon-"],
.reveal [class*=" icon-"]  {
  font-family: 'FontAwesome';
}

Then add fa-icon before all your icons
This is for performance reasons about the universal selector.

@VonC VonC deleted the font-family-before branch October 11, 2013 12:17
@VonC
Copy link
Author

VonC commented Oct 11, 2013

@tagliala Ok, I have fixed my fa-icon css and usage: it does work fine 😄

Again, it will be useful to read about that kind of setting in the Get Started page, both for 3.2.x and the upcoming 4.0.0.

VonC added a commit to VonC/Font-Awesome that referenced this pull request Oct 13, 2013
When using Font-Awesome without Bootstrap, it can be useful to
check out external resources:

- the Troubleshooting wiki page
- the Stack Overflow questions

That follows FortAwesome#2131, which lead to FortAwesome#2136.
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

Successfully merging this pull request may close these issues.

None yet

2 participants