Dar estilo a los botones HTML5 de datatables plugin

publicado por: Anonymous

Buenas tardes alguien sabe como se le da estilo a los botones de datatables plugins les agradezco de antemano

                "dom": 'Bfrtip',
                        "buttons": [
                            'copyHtml5',
                            'excelHtml5',
                            'csvHtml5',
                            'pdfHtml5'
                        ]

solución

De esta manera le puedes dar un estilo propio a los Buttons de Datatable

_x000D_

_x000D_

$(document).ready(function() {_x000D_
  $('#example').DataTable({_x000D_
    dom: 'lfrtipB',_x000D_
    buttons: [{_x000D_
        //Botón para Excel_x000D_
        extend: 'excel',_x000D_
        footer: true,_x000D_
        title: 'Archivo',_x000D_
        filename: 'Export_File',_x000D_
_x000D_
        //Aquí es donde generas el botón personalizado_x000D_
        text: '<button class="btn btn-success">Exportar a Excel <i class="fas fa-file-excel"></i></button>'_x000D_
      },_x000D_
      //Botón para PDF_x000D_
      {_x000D_
        extend: 'pdf',_x000D_
        footer: true,_x000D_
        title: 'Archivo PDF',_x000D_
        filename: 'Export_File_pdf',_x000D_
        text: '<button class="btn btn-danger">Exportar a PDF <i class="far fa-file-pdf"></i></button>'_x000D_
      }_x000D_
    ]_x000D_
  });_x000D_
});

_x000D_

.dt-button {_x000D_
  padding: 0;_x000D_
  border: none;_x000D_
}

_x000D_

<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" rel="stylesheet" />_x000D_
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.8.1/css/all.css" integrity="sha384-50oBUHEmvpQ+1lW4y57PTFmhCaXp0ML5d60M1M7uH2+nqUivzIebhndOJK28anvf" crossorigin="anonymous">_x000D_
<link href="https://cdn.datatables.net/1.10.19/css/jquery.dataTables.min.css" rel="stylesheet" />_x000D_
_x000D_
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>_x000D_
<script src="https://cdn.datatables.net/1.10.19/js/jquery.dataTables.min.js"></script>_x000D_
<script src="https://cdn.datatables.net/buttons/1.5.6/js/dataTables.buttons.min.js"></script>_x000D_
<script src="https://cdnjs.cloudflare.com/ajax/libs/jszip/3.1.3/jszip.min.js"></script>_x000D_
<script src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.53/pdfmake.min.js"></script>_x000D_
<script src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.53/vfs_fonts.js"></script>_x000D_
<script src="https://cdn.datatables.net/buttons/1.5.6/js/buttons.html5.min.js"></script>_x000D_
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js"></script>_x000D_
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.bundle.min.js"></script>_x000D_
_x000D_
<table id="example" class="display" style="width:100%">_x000D_
  <thead>_x000D_
    <tr>_x000D_
      <th>Name</th>_x000D_
      <th>Position</th>_x000D_
      <th>Office</th>_x000D_
      <th>Extn.</th>_x000D_
      <th>Start date</th>_x000D_
      <th>Salary</th>_x000D_
    </tr>_x000D_
  </thead>_x000D_
  <tbody>_x000D_
    <tr>_x000D_
      <td>Tiger Nixon</td>_x000D_
      <td>System Architect</td>_x000D_
      <td>Edinburgh</td>_x000D_
      <td>61</td>_x000D_
      <td>2011/04/25</td>_x000D_
      <td>$320,800</td>_x000D_
    </tr>_x000D_
    <tr>_x000D_
      <td>Garrett Winters</td>_x000D_
      <td>Accountant</td>_x000D_
      <td>Tokyo</td>_x000D_
      <td>63</td>_x000D_
      <td>2011/07/25</td>_x000D_
      <td>$170,750</td>_x000D_
    </tr>_x000D_
    <tr>_x000D_
      <td>Ashton Cox</td>_x000D_
      <td>Junior Technical Author</td>_x000D_
      <td>San Francisco</td>_x000D_
      <td>66</td>_x000D_
      <td>2009/01/12</td>_x000D_
      <td>$86,000</td>_x000D_
    </tr>_x000D_
    <tr>_x000D_
      <td>Cedric Kelly</td>_x000D_
      <td>Senior Javascript Developer</td>_x000D_
      <td>Edinburgh</td>_x000D_
      <td>22</td>_x000D_
      <td>2012/03/29</td>_x000D_
      <td>$433,060</td>_x000D_
    </tr>_x000D_
    <tr>_x000D_
      <td>Airi Satou</td>_x000D_
      <td>Accountant</td>_x000D_
      <td>Tokyo</td>_x000D_
      <td>33</td>_x000D_
      <td>2008/11/28</td>_x000D_
      <td>$162,700</td>_x000D_
    </tr>_x000D_
    <tr>_x000D_
      <td>Brielle Williamson</td>_x000D_
      <td>Integration Specialist</td>_x000D_
      <td>New York</td>_x000D_
      <td>61</td>_x000D_
      <td>2012/12/02</td>_x000D_
      <td>$372,000</td>_x000D_
    </tr>_x000D_
    <tr>_x000D_
      <td>Herrod Chandler</td>_x000D_
      <td>Sales Assistant</td>_x000D_
      <td>San Francisco</td>_x000D_
      <td>59</td>_x000D_
      <td>2012/08/06</td>_x000D_
      <td>$137,500</td>_x000D_
    </tr>_x000D_
    <tr>_x000D_
      <td>Rhona Davidson</td>_x000D_
      <td>Integration Specialist</td>_x000D_
      <td>Tokyo</td>_x000D_
      <td>55</td>_x000D_
      <td>2010/10/14</td>_x000D_
      <td>$327,900</td>_x000D_
    </tr>_x000D_
    <tr>_x000D_
      <td>Colleen Hurst</td>_x000D_
      <td>Javascript Developer</td>_x000D_
      <td>San Francisco</td>_x000D_
      <td>39</td>_x000D_
      <td>2009/09/15</td>_x000D_
      <td>$205,500</td>_x000D_
    </tr>_x000D_
    <tr>_x000D_
      <td>Sonya Frost</td>_x000D_
      <td>Software Engineer</td>_x000D_
      <td>Edinburgh</td>_x000D_
      <td>23</td>_x000D_
      <td>2008/12/13</td>_x000D_
      <td>$103,600</td>_x000D_
    </tr>_x000D_
    <tr>_x000D_
      <td>Jena Gaines</td>_x000D_
      <td>Office Manager</td>_x000D_
      <td>London</td>_x000D_
      <td>30</td>_x000D_
      <td>2008/12/19</td>_x000D_
      <td>$90,560</td>_x000D_
    </tr>_x000D_
    <tr>_x000D_
      <td>Quinn Flynn</td>_x000D_
      <td>Support Lead</td>_x000D_
      <td>Edinburgh</td>_x000D_
      <td>22</td>_x000D_
      <td>2013/03/03</td>_x000D_
      <td>$342,000</td>_x000D_
    </tr>_x000D_
    <tr>_x000D_
      <td>Charde Marshall</td>_x000D_
      <td>Regional Director</td>_x000D_
      <td>San Francisco</td>_x000D_
      <td>36</td>_x000D_
      <td>2008/10/16</td>_x000D_
      <td>$470,600</td>_x000D_
    </tr>_x000D_
    <tr>_x000D_
      <td>Haley Kennedy</td>_x000D_
      <td>Senior Marketing Designer</td>_x000D_
      <td>London</td>_x000D_
      <td>43</td>_x000D_
      <td>2012/12/18</td>_x000D_
      <td>$313,500</td>_x000D_
    </tr>_x000D_
    <tr>_x000D_
      <td>Tatyana Fitzpatrick</td>_x000D_
      <td>Regional Director</td>_x000D_
      <td>London</td>_x000D_
      <td>19</td>_x000D_
      <td>2010/03/17</td>_x000D_
      <td>$385,750</td>_x000D_
    </tr>_x000D_
    <tr>_x000D_
      <td>Michael Silva</td>_x000D_
      <td>Marketing Designer</td>_x000D_
      <td>London</td>_x000D_
      <td>66</td>_x000D_
      <td>2012/11/27</td>_x000D_
      <td>$198,500</td>_x000D_
    </tr>_x000D_
    <tr>_x000D_
      <td>Paul Byrd</td>_x000D_
      <td>Chief Financial Officer (CFO)</td>_x000D_
      <td>New York</td>_x000D_
      <td>64</td>_x000D_
      <td>2010/06/09</td>_x000D_
      <td>$725,000</td>_x000D_
    </tr>_x000D_
    <tr>_x000D_
      <td>Gloria Little</td>_x000D_
      <td>Systems Administrator</td>_x000D_
      <td>New York</td>_x000D_
      <td>59</td>_x000D_
      <td>2009/04/10</td>_x000D_
      <td>$237,500</td>_x000D_
    </tr>_x000D_
    <tr>_x000D_
      <td>Bradley Greer</td>_x000D_
      <td>Software Engineer</td>_x000D_
      <td>London</td>_x000D_
      <td>41</td>_x000D_
      <td>2012/10/13</td>_x000D_
      <td>$132,000</td>_x000D_
    </tr>_x000D_
    <tr>_x000D_
      <td>Dai Rios</td>_x000D_
      <td>Personnel Lead</td>_x000D_
      <td>Edinburgh</td>_x000D_
      <td>35</td>_x000D_
      <td>2012/09/26</td>_x000D_
      <td>$217,500</td>_x000D_
    </tr>_x000D_
    <tr>_x000D_
      <td>Jenette Caldwell</td>_x000D_
      <td>Development Lead</td>_x000D_
      <td>New York</td>_x000D_
      <td>30</td>_x000D_
      <td>2011/09/03</td>_x000D_
      <td>$345,000</td>_x000D_
    </tr>_x000D_
    <tr>_x000D_
      <td>Yuri Berry</td>_x000D_
      <td>Chief Marketing Officer (CMO)</td>_x000D_
      <td>New York</td>_x000D_
      <td>40</td>_x000D_
      <td>2009/06/25</td>_x000D_
      <td>$675,000</td>_x000D_
    </tr>_x000D_
    <tr>_x000D_
      <td>Caesar Vance</td>_x000D_
      <td>Pre-Sales Support</td>_x000D_
      <td>New York</td>_x000D_
      <td>21</td>_x000D_
      <td>2011/12/12</td>_x000D_
      <td>$106,450</td>_x000D_
    </tr>_x000D_
    <tr>_x000D_
      <td>Doris Wilder</td>_x000D_
      <td>Sales Assistant</td>_x000D_
      <td>Sidney</td>_x000D_
      <td>23</td>_x000D_
      <td>2010/09/20</td>_x000D_
      <td>$85,600</td>_x000D_
    </tr>_x000D_
    <tr>_x000D_
      <td>Angelica Ramos</td>_x000D_
      <td>Chief Executive Officer (CEO)</td>_x000D_
      <td>London</td>_x000D_
      <td>47</td>_x000D_
      <td>2009/10/09</td>_x000D_
      <td>$1,200,000</td>_x000D_
    </tr>_x000D_
    <tr>_x000D_
      <td>Gavin Joyce</td>_x000D_
      <td>Developer</td>_x000D_
      <td>Edinburgh</td>_x000D_
      <td>42</td>_x000D_
      <td>2010/12/22</td>_x000D_
      <td>$92,575</td>_x000D_
    </tr>_x000D_
    <tr>_x000D_
      <td>Jennifer Chang</td>_x000D_
      <td>Regional Director</td>_x000D_
      <td>Singapore</td>_x000D_
      <td>28</td>_x000D_
      <td>2010/11/14</td>_x000D_
      <td>$357,650</td>_x000D_
    </tr>_x000D_
    <tr>_x000D_
      <td>Brenden Wagner</td>_x000D_
      <td>Software Engineer</td>_x000D_
      <td>San Francisco</td>_x000D_
      <td>28</td>_x000D_
      <td>2011/06/07</td>_x000D_
      <td>$206,850</td>_x000D_
    </tr>_x000D_
    <tr>_x000D_
      <td>Fiona Green</td>_x000D_
      <td>Chief Operating Officer (COO)</td>_x000D_
      <td>San Francisco</td>_x000D_
      <td>48</td>_x000D_
      <td>2010/03/11</td>_x000D_
      <td>$850,000</td>_x000D_
    </tr>_x000D_
    <tr>_x000D_
      <td>Shou Itou</td>_x000D_
      <td>Regional Marketing</td>_x000D_
      <td>Tokyo</td>_x000D_
      <td>20</td>_x000D_
      <td>2011/08/14</td>_x000D_
      <td>$163,000</td>_x000D_
    </tr>_x000D_
    <tr>_x000D_
      <td>Michelle House</td>_x000D_
      <td>Integration Specialist</td>_x000D_
      <td>Sidney</td>_x000D_
      <td>37</td>_x000D_
      <td>2011/06/02</td>_x000D_
      <td>$95,400</td>_x000D_
    </tr>_x000D_
    <tr>_x000D_
      <td>Suki Burks</td>_x000D_
      <td>Developer</td>_x000D_
      <td>London</td>_x000D_
      <td>53</td>_x000D_
      <td>2009/10/22</td>_x000D_
      <td>$114,500</td>_x000D_
    </tr>_x000D_
    <tr>_x000D_
      <td>Prescott Bartlett</td>_x000D_
      <td>Technical Author</td>_x000D_
      <td>London</td>_x000D_
      <td>27</td>_x000D_
      <td>2011/05/07</td>_x000D_
      <td>$145,000</td>_x000D_
    </tr>_x000D_
    <tr>_x000D_
      <td>Gavin Cortez</td>_x000D_
      <td>Team Leader</td>_x000D_
      <td>San Francisco</td>_x000D_
      <td>22</td>_x000D_
      <td>2008/10/26</td>_x000D_
      <td>$235,500</td>_x000D_
    </tr>_x000D_
    <tr>_x000D_
      <td>Martena Mccray</td>_x000D_
      <td>Post-Sales support</td>_x000D_
      <td>Edinburgh</td>_x000D_
      <td>46</td>_x000D_
      <td>2011/03/09</td>_x000D_
      <td>$324,050</td>_x000D_
    </tr>_x000D_
    <tr>_x000D_
      <td>Unity Butler</td>_x000D_
      <td>Marketing Designer</td>_x000D_
      <td>San Francisco</td>_x000D_
      <td>47</td>_x000D_
      <td>2009/12/09</td>_x000D_
      <td>$85,675</td>_x000D_
    </tr>_x000D_
    <tr>_x000D_
      <td>Howard Hatfield</td>_x000D_
      <td>Office Manager</td>_x000D_
      <td>San Francisco</td>_x000D_
      <td>51</td>_x000D_
      <td>2008/12/16</td>_x000D_
      <td>$164,500</td>_x000D_
    </tr>_x000D_
    <tr>_x000D_
      <td>Hope Fuentes</td>_x000D_
      <td>Secretary</td>_x000D_
      <td>San Francisco</td>_x000D_
      <td>41</td>_x000D_
      <td>2010/02/12</td>_x000D_
      <td>$109,850</td>_x000D_
    </tr>_x000D_
    <tr>_x000D_
      <td>Vivian Harrell</td>_x000D_
      <td>Financial Controller</td>_x000D_
      <td>San Francisco</td>_x000D_
      <td>62</td>_x000D_
      <td>2009/02/14</td>_x000D_
      <td>$452,500</td>_x000D_
    </tr>_x000D_
    <tr>_x000D_
      <td>Timothy Mooney</td>_x000D_
      <td>Office Manager</td>_x000D_
      <td>London</td>_x000D_
      <td>37</td>_x000D_
      <td>2008/12/11</td>_x000D_
      <td>$136,200</td>_x000D_
    </tr>_x000D_
    <tr>_x000D_
      <td>Jackson Bradshaw</td>_x000D_
      <td>Director</td>_x000D_
      <td>New York</td>_x000D_
      <td>65</td>_x000D_
      <td>2008/09/26</td>_x000D_
      <td>$645,750</td>_x000D_
    </tr>_x000D_
    <tr>_x000D_
      <td>Olivia Liang</td>_x000D_
      <td>Support Engineer</td>_x000D_
      <td>Singapore</td>_x000D_
      <td>64</td>_x000D_
      <td>2011/02/03</td>_x000D_
      <td>$234,500</td>_x000D_
    </tr>_x000D_
    <tr>_x000D_
      <td>Bruno Nash</td>_x000D_
      <td>Software Engineer</td>_x000D_
      <td>London</td>_x000D_
      <td>38</td>_x000D_
      <td>2011/05/03</td>_x000D_
      <td>$163,500</td>_x000D_
    </tr>_x000D_
    <tr>_x000D_
      <td>Sakura Yamamoto</td>_x000D_
      <td>Support Engineer</td>_x000D_
      <td>Tokyo</td>_x000D_
      <td>37</td>_x000D_
      <td>2009/08/19</td>_x000D_
      <td>$139,575</td>_x000D_
    </tr>_x000D_
    <tr>_x000D_
      <td>Thor Walton</td>_x000D_
      <td>Developer</td>_x000D_
      <td>New York</td>_x000D_
      <td>61</td>_x000D_
      <td>2013/08/11</td>_x000D_
      <td>$98,540</td>_x000D_
    </tr>_x000D_
    <tr>_x000D_
      <td>Finn Camacho</td>_x000D_
      <td>Support Engineer</td>_x000D_
      <td>San Francisco</td>_x000D_
      <td>47</td>_x000D_
      <td>2009/07/07</td>_x000D_
      <td>$87,500</td>_x000D_
    </tr>_x000D_
    <tr>_x000D_
      <td>Serge Baldwin</td>_x000D_
      <td>Data Coordinator</td>_x000D_
      <td>Singapore</td>_x000D_
      <td>64</td>_x000D_
      <td>2012/04/09</td>_x000D_
      <td>$138,575</td>_x000D_
    </tr>_x000D_
    <tr>_x000D_
      <td>Zenaida Frank</td>_x000D_
      <td>Software Engineer</td>_x000D_
      <td>New York</td>_x000D_
      <td>63</td>_x000D_
      <td>2010/01/04</td>_x000D_
      <td>$125,250</td>_x000D_
    </tr>_x000D_
    <tr>_x000D_
      <td>Zorita Serrano</td>_x000D_
      <td>Software Engineer</td>_x000D_
      <td>San Francisco</td>_x000D_
      <td>56</td>_x000D_
      <td>2012/06/01</td>_x000D_
      <td>$115,000</td>_x000D_
    </tr>_x000D_
    <tr>_x000D_
      <td>Jennifer Acosta</td>_x000D_
      <td>Junior Javascript Developer</td>_x000D_
      <td>Edinburgh</td>_x000D_
      <td>43</td>_x000D_
      <td>2013/02/01</td>_x000D_
      <td>$75,650</td>_x000D_
    </tr>_x000D_
    <tr>_x000D_
      <td>Cara Stevens</td>_x000D_
      <td>Sales Assistant</td>_x000D_
      <td>New York</td>_x000D_
      <td>46</td>_x000D_
      <td>2011/12/06</td>_x000D_
      <td>$145,600</td>_x000D_
    </tr>_x000D_
    <tr>_x000D_
      <td>Hermione Butler</td>_x000D_
      <td>Regional Director</td>_x000D_
      <td>London</td>_x000D_
      <td>47</td>_x000D_
      <td>2011/03/21</td>_x000D_
      <td>$356,250</td>_x000D_
    </tr>_x000D_
    <tr>_x000D_
      <td>Lael Greer</td>_x000D_
      <td>Systems Administrator</td>_x000D_
      <td>London</td>_x000D_
      <td>21</td>_x000D_
      <td>2009/02/27</td>_x000D_
      <td>$103,500</td>_x000D_
    </tr>_x000D_
    <tr>_x000D_
      <td>Jonas Alexander</td>_x000D_
      <td>Developer</td>_x000D_
      <td>San Francisco</td>_x000D_
      <td>30</td>_x000D_
      <td>2010/07/14</td>_x000D_
      <td>$86,500</td>_x000D_
    </tr>_x000D_
    <tr>_x000D_
      <td>Shad Decker</td>_x000D_
      <td>Regional Director</td>_x000D_
      <td>Edinburgh</td>_x000D_
      <td>51</td>_x000D_
      <td>2008/11/13</td>_x000D_
      <td>$183,000</td>_x000D_
    </tr>_x000D_
    <tr>_x000D_
      <td>Michael Bruce</td>_x000D_
      <td>Javascript Developer</td>_x000D_
      <td>Singapore</td>_x000D_
      <td>29</td>_x000D_
      <td>2011/06/27</td>_x000D_
      <td>$183,000</td>_x000D_
    </tr>_x000D_
    <tr>_x000D_
      <td>Donna Snider</td>_x000D_
      <td>Customer Support</td>_x000D_
      <td>New York</td>_x000D_
      <td>27</td>_x000D_
      <td>2011/01/25</td>_x000D_
      <td>$112,000</td>_x000D_
    </tr>_x000D_
  </tbody>_x000D_
  <tfoot>_x000D_
    <tr>_x000D_
      <th>Name</th>_x000D_
      <th>Position</th>_x000D_
      <th>Office</th>_x000D_
      <th>Extn.</th>_x000D_
      <th>Start date</th>_x000D_
      <th>Salary</th>_x000D_
    </tr>_x000D_
  </tfoot>_x000D_
</table>

_x000D_

_x000D_

_x000D_

Respondido por: Anonymous

Leave a Reply

Your email address will not be published. Required fields are marked *