HTML5: Linking to Javascript and CSS files

With HTML5, it is easy to link to an external file such as a javascript file or CSS stylesheet file.

Below here the example syntax:

<script src='jquery-ui.js'></script>
<link rel='stylesheet' href='jqueryui_style.css'>

Do take note of the src attribute for Javascript(js) file and the href attribute for css file.

<!DOCTYPE html>
<html>
<head lang='en'>
    <meta charset='UTF-8'>
    <script src='jquery-ui.js'></script>
    <link rel='stylesheet' href='jqueryui_style.css'>
    <title></title>
</head>
<body>

</body>
</html>

If the external file is a url, you can put the full url in the code.

<script src='//codecrawl.com/code/jquery-ui.js'></script>
<link rel='stylesheet' href='//codecrawl.com/code/jqueryui_style.css'>
Series Navigation<< HTML5: Character encoding with charset
HTML5: Syntax writing style >>