How to change the font family of datatables export buttons

How to change the font family of datatables export buttons

dk1301dk1301 Posts: 3Questions: 1Answers: 0

In my website I have implemented the datatables export buttons. However since my website has custom fonts I'd like to know
how one can change the font-family of the export buttons. I tried by adding in my main.css file

.dt-button {
  font-family: MyFontCapital;
  src: url('../font/MyFontCapital.otf');
}

or

.dt-button-collection{
  font-family: MyFontCapital;
  src: url('../font/MyFontCapital.otf');
}

but neither worked. I also searched the datatables site but didn't find any example that font-family is set during datatable initialization. Any idea what I should do?

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 61,446Questions: 1Answers: 10,054 Site admin

    didn't find any example that font-family is set during datatable initialization

    It isn't - using CSS is the correct way to do it.

    Can you link to your page so I can take a look and try to help debug it please?

    Allan

  • dk1301dk1301 Posts: 3Questions: 1Answers: 0
    edited July 2017

    Hi Allan,
    unfortunatelly both the website and the fonts are going to be used for a commercial app so I cannot link my page. I just want to add that the main.css has the following font settings:

    @font-face {
        font-family: MyFontCapital;
        src: url('../font/MyFontCapital.otf'); 
    }
    @font-face {
        font-family: MyFontSansRegular;
        src: url('../font/MyFontSans-Regular.otf'); 
    }
    @font-face {
        font-family: MyFontSansMedium;
        src: url('../font/ MyFontSans-Medium.otf'); 
    }
    

    What else can I try from CSS point of view ? Sorry for the inconvenience.

  • allanallan Posts: 61,446Questions: 1Answers: 10,054 Site admin
    Answer ✓

    I've just tried this with a Google web font:

    div.dt-buttons {
      font-family: 'Lemonada', cursive;
    }
    

    It seems to work as expected.

    Allan

  • dk1301dk1301 Posts: 3Questions: 1Answers: 0

    Hi again and thanks for you help. It worked perfectly. It seems that the src command created the problem.

This discussion has been closed.