HTML Flashcards

(3 cards)

1
Q

What are all the Boolean attributes you can add to your video inner html? Why would you use a “source” tag inside a video element instead of using src=“” in the inner HTML?

A

controls
autoplay
mute
loop

Having multiple source elements inside a video element allows for backups in case the browser doesn’t support the video file. It goes from the top down, sort of like giving multiple font styles will choose the first in order that works with the browser.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What is the relationship between HTML and the DOM?

A

HTML is the raw text code that defines the structure and content of a webpage — like elements, tags, and attributes.

The DOM (Document Object Model) is the live, in-memory tree structure that the browser builds from the HTML.

It’s what JavaScript actually interacts with.

🧠 Think of it like this:
HTML = the blueprint (static source code)

DOM = the constructed building in memory that can be modified or queried in real time

For example:

You write <h1>Hello</h1> in HTML

The browser turns it into a DOM element document.querySelector(‘h1’)

JavaScript can then modify it: h1.textContent = “Goodbye”

The DOM is the JavaScript Object representation of the HTML, and both always match each other. Changes to the DOM change the HTML and changes to the HTML change the DOM.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

When we access HTML elements via the DOM, what is unique of the DOM’s version of these elements?

A

Each element has its own methods and properties. For example, a sub object “h1” from the DOM has “addEventListener” method where we can listen to a click on the header element.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly