I've been puzzled by this for a little while and am wondering if anyone can shed some light on this topic. I have an HTML file, a CSS file (stylesheet.css
), and a JavaScript file (java.js
), all in the same directory (I know its advisable to separate files by type into different directories, but I'm just running some tests right now and it's convenient to have them share one). By my understanding (I'm new to all three), the proper way to have HTML execute the CSS and JS files is by including them in the <head> … </head>
tag such as below.
<head>
<meta charset="utf-8">
<title>Table Fixed Header</title>
<link rel="stylesheet" href="stylesheet.css">
<script src="javascript.js"></script>
</head>
EDIT: new location of <script> and <link>
<!-- More table is above this -->
<tr>
<td>Data Column 1</td>
<td>Data Column 2</td>
<td>Data Column 3</td>
<td>Data Column 4</td>
</tr>
</tbody>
</div>
<link rel="stylesheet" href="stylesheet.css">
<script src="javascript.js"></script>
</body>
Still, only the table with none of the styling or scripting appears
This way, as HTML executes, it should interpret both the CSS and JS files and apply them to the rest of the HTML script.
In my case, I have multiple tables written in the HTML and the JS provides fixed header scrolling and CSS just makes everything look better (obviously). However, when I execute the code on my local server, only the raw HTML appears. There are no errors in the console log. What is happening here?