A tag has a name and attributes
google "generate html attributes cheat sheet for beginners"
eg. src, href, width, height
Not all attributes apply to all tags
There are, however, global attributes that apply to ALL tags.
There are 2 relevant global HTML atributes for CSS and javascript, they are:
- id
- class
w3schools tutorial:
W3schools reference:
google "generate css cheat sheet for beginners"
- CSS rules Structure of CSS
selector { property: value; }
eg.
p {
color: blue;
font-size: 16px;
}
- CSS Selectors (which HTML elements should CSS properties be applied to )
type selector:
<p>This will be green</p>
<p>So will this</p>
p {
color: green;
}
ID selector:
<p id="boo">Only one element can have id equal to boo, and this will be green</p>
#boo {
color: green;
}
class selector:
<p class="boo moo poo">This para will be green</p>
<p class="boo">So will this one</p>
<p class="moo">But not this one</p>
.boo {
color: green;
}
List to all of the first 80 seconds of:
HTML represents initial page view
DOM represents live page view
When you change the DOM, you change the page.
google "javascript values variables"
In JavaScript, variables are named containers used to store values. These values can be various types of data, such as numbers, text (strings), booleans (true/false)
google "what can javascript do to html"
JavaScript interacts with HTML through the Document Object Model (DOM)
With the document object
<p id="boo">Change me somehow</p>
const element = document.querySelector("#boo")
element.textContent = "I will change you"
- VSCode with Live Preview extension
- Chrome->right click-> inspect-> console
- My own site: Blockly and javascript
- w3chools
A value cannot change, a variable can change