Font-Awesome icons not rendering via the BoostrapCDN

后端 未结 3 1970
醉酒成梦
醉酒成梦 2021-01-14 02:03

I\'m trying to use Font-Awesome icon fonts via the BootstrapCDN link which I\'m pretty sure I have the latest version of:



        
相关标签:
3条回答
  • 2021-01-14 02:08

    Such an easier way to deal with this - just add 'http:' in front for the cdn line, and it will work on your local machine, i.e. like this:

    <link href="http://maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css" rel="stylesheet">
    

    Ta-daa!

    0 讨论(0)
  • 2021-01-14 02:12

    What Pulkit answered is absolutely correct. Just to add, if you want to create a quick local server, just go to the directory of the html and css pages, and then go to the terminal and type -

    $python -m SimpleHTTPServer

    Then, go to your browser and go to 127.0.0.1:8000 If it doesn't show up, try changing the homepage of your website to index.html

    0 讨论(0)
  • 2021-01-14 02:19

    The reason it is not loading is because the URI is starting with "//". That signifies that it is a protocol relative path, meaning it will use whatever protocol that page is using. If you open your html locally, then your browser will use file as the protocol, thus trying to access the font-awesome css with "file://". If you access your html using a local or remote http web server, then you would access the page using the http protocol, thus accessing the css with "http://".

    Solution:

    1. Change the path of the css or mimic it on your local machine.
    2. Run a local or remote http server and access the page.

    For more info: URI starting with two slashes ... how do they behave?

    0 讨论(0)
提交回复
热议问题