codeigniter-3font-awesomewebfontsfont-familycustom-font

Need to add a font family in CodeIgniter


I am working on a CodeIgniter project. I need to add a custom font family in CodeIgniter which will be used in over all project. I have downloaded the font files of ttf, eot and wof. I have added these files in the font folder in CodeIgniter then i have updated the style.css file in asset with @font-face. I have declared the font family name for the body and other tags but it's working I'm not sure where did I go wrong.

This is the font face I have added in the style.css file in asset folder.

@font-face {
    font-family: 'Poppins';
    src: url('../font-awesome/fonts/Poppins-Black.eot');
    src: local('../font-awesome/fonts/Poppins Black'), local('Poppins-Black'),
        url('../font-awesome/fonts/Poppins-Black.eot?#iefix') format('embedded-opentype'),
        url('../font-awesome/fonts/Poppins-Black.woff') format('woff'),
        url('../font-awesome/fonts/Poppins-Black.ttf') format('truetype');
    font-weight: 900;
    font-style: normal;
}
body {
    font-family: 'Poppins', sans-serif;
    font-size: 16px;
    font-weight: 300;
    color: #888;
    line-height: normal;
    text-align: center;
}

Solution

  • you can create a template.php file to use all over your project then add your style link in there:

    <link rel="stylesheet" href=<?php echo base_url('css/style.css'); ?>>
    

    The structure of your project may be like this:

    /application
       /controllers
       /models
       /views
    /css
       /font-awesome
       style.css (you should change the urls inside this file base on your structure)
    /system
    

    Make sure you load html helper to use base_url function

    Another way is using the html helper in here