1//Pure JavaScript DOM
2var el = document.getElementById("elementID");
3el.style.css-property = "cssattribute";
4
5//When doing A CSS property that have multiple words, its typed differently
6//Instead of spaces or dashes, use camelCase
7//Example:
8el.style.backgroundColor = "blue";
9
10//Make sure before using jQuery, link the jQuery library to your code
11//JavaScript with jQuery
12//jQuery can use CSS property to fid=nd an element
13$("#elementID").css("css-property", "css-attribute");
14
15//On jQuery, the CSS property is typed like normal CSS property
16//Example:
17$("#elementID").css("background-color", "blue");
18
19//If you want multiple property for jQuery, you can stack them on one code
20//instead of typing each attribute
21//Example:
22$("#elementID").css({"css-property": "css-attribute", "css-property": "css-attribute"});
23
24//you can also make them nice by adding line breaks
25//Example:
26$("#elementID").css({
27 "css-property": "css-attribute",
28 "css-property": "css-attribute"});
29//You can add as much CSS property and attribute as you want
30//just make sure, always end it with a comma before adding another one
31//the last property doesn't need a comma
32
1<p id="demo"></p>
2
3<script>
4document.getElementById("demo") = "red";
5</script>
6