how to add css and javascript in html code example

Example 1: how to link javascript to html and css

# Javascript
<script src="[file_name].js"></script>

# CSS
<link rel = "stylesheet" type="text/css" href = "style.css" />

Example 2: link css file in html

<link rel="stylesheet" href="styles.css">

Example 3: how to give css style in javascript

document.getElementById("myH1").style.color = "red";

Example 4: add css in javascript

document.getElementById("demo").style.display = "none";

Tags:

Css Example