Why font-awesome works on localhost but not on web ?

前端 未结 11 1822
感情败类
感情败类 2020-12-02 13:57

I\'m using font awesome in my project(mvc/asp.net). My problem is, I was debugging the project and check on localhost, there was no problem with fo

11条回答
  •  悲哀的现实
    2020-12-02 14:45

    It depends on this code line in BundleConfig:

            BundleTable.EnableOptimizations = true;
    

    if it is true, you have to change your Font files's path;

    ../ is shows root path, main folder of your project. And then you have to write rest of the path.

    Mine. When it's true:

    font-family: 'Icons';
        src:url('../_include/css/fonts/Icons.eot');
        src:url('../_include/css/fonts/Icons.eot?#iefix') format('embedded-opentype'),
            url('../_include/css/fonts/Icons.woff') format('woff'),
            url('../_include/css/fonts/Icons.ttf') format('truetype'),
            url('../_include/css/fonts/Icons.svg#Icons') format('svg');
        font-weight: normal;
        font-style: normal;
    

    When it's false:

    font-family: 'Icons';
        src:url('fonts/Icons.eot');
        src:url('fonts/Icons.eot?#iefix') format('embedded-opentype'),
            url('fonts/Icons.woff') format('woff'),
            url('fonts/Icons.ttf') format('truetype'),
            url('fonts/Icons.svg#Icons') format('svg');
        font-weight: normal;
        font-style: normal;
    

提交回复
热议问题