Monday, May 20, 2024
 Popular · Latest · Hot · Upcoming
54
rated 0 times [  61] [ 7]  / answers: 1 / hits: 31026  / 8 Years ago, sun, august 21, 2016, 12:00:00

I have a peculiar problem. I am developing a php site that required Datatables to work with it. I noticed that Datatables styling does not work when I run it on localhost be it Firefox or Chrome. My code is as follows:



<!DOCTYPE html>
<!--
To change this license header, choose License Headers in Project Properties.
To change this template file, choose Tools | Templates
and open the template in the editor.
-->
<html>
<head>
<meta charset=UTF-8>
<title></title>
<link rel=text/css href=//cdn.datatables.net/1.10.12/css/jquery.dataTables.min.css/>
<script src=//code.jquery.com/jquery-2.2.3.js type=text/javascript></script>
<script src=//cdn.datatables.net/1.10.12/js/jquery.dataTables.min.js type=text/javascript></script>
<script>
$(document).ready(function() {
$('#example').DataTable();
} );
</script>
</head>
<body>
<table id=example class=display cellspacing=0 width=100%>
<thead>
<tr>
<th>Name</th>
<th>Position</th>
<th>Office</th>
<th>Age</th>
<th>Start date</th>
<th>Salary</th>
</tr>
</thead>
<tfoot>
<tr>
<th>Name</th>
<th>Position</th>
<th>Office</th>
<th>Age</th>
<th>Start date</th>
<th>Salary</th>
</tr>
</tfoot>
<tbody>
<tr>
<td>Tiger Nixon</td>
<td>System Architect</td>
<td>Edinburgh</td>
<td>61</td>
<td>2011/04/25</td>
<td>$320,800</td>
</tr>
<tr>
<td>Garrett Winters</td>
<td>Accountant</td>
<td>Tokyo</td>
<td>63</td>
<td>2011/07/25</td>
<td>$170,750</td>
</tr>
<tr>
<td>Ashton Cox</td>
<td>Junior Technical Author</td>
<td>San Francisco</td>
<td>66</td>
<td>2009/01/12</td>
<td>$86,000</td>
</tr>
</tbody>
</table>
</body>
</html>


And this gives me a rather ugly version of the datatable. Search functionalities and filtering works but is missing styles and column reordering.



However the strange thing is that a jsfiddle that I drew up containing the same data render as expected, with all styling, etc... The fiddle link is as follows: https://jsfiddle.net/gkyya29h/



I'm using XAMPP server with firefox as my default browser. Can someone help me figure this out? I may be doing some very obvious mistake but I'm failing to see it. Thank You.


More From » css

 Answers
3
<link rel=stylesheet type=text/css href=//cdn.datatables.net/1.10.12/css/jquery.dataTables.min.css>


Your link tag to CSS is wrong. Maybe some browsers won't process it correctly.


[#60968] Thursday, August 18, 2016, 8 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
deniseryannd

Total Points: 169
Total Questions: 85
Total Answers: 96

Location: Virgin Islands (U.S.)
Member since Fri, May 7, 2021
3 Years ago
;