HTML Flashcards
Where do you put non-visible content about the HTML document?
Head
Where do you put visible content about the HTML document?
Body
Where do the head and body tags go in a valid HTML document?
Nested as a child of the HTML element.
What is the purpose of a !DOCTYPE declaration?
To let the browser know what type of documentation to display.
Give five examples of HTML element tags.
head, body, html, div, span
What is the purpose of HTML attributes?
To give more information about an element; makes it special or unique from other elements.
Give an example of an HTML entity (escape character).
trademarks, copyrights, greater than, less than, etc
How do block-level elements affect the document flow?
They start on a new line and take up the entire line.
How do inline elements affect the document flow?
They only take up the space they need and can remain on the same line.
What are the default width and height of a block-level element?
The default width is 100% of the viewpoint and height is usually set to auto (how much it needs).
What are the default width and height of an inline element?
Default width and height are measured by exactly how much they need.
What is the difference between an ordered list and an unordered list in HTML?
An ordered list displays in a numbered order. An unordered list is displayed with bullet points.
Is an HTML list a block element or an inline element?
It is a block element.
What HTML tag is used to link to another website?
With an a tag.
What is an absolute URL?
When the value of href(attribute) is linked to another page in another website.
What is a relative URL?
It is a link to another page or section within the same site.
How do you indicate the relative link to a parent directory?
It is indicated by ../
How do you indicate the relative link to a child directory?
Using the name of the directory followed by ‘/’ and then the name of the file.
How do you indicate the relative link to a grand parent directory?
It is indicated by ../../ and then the name of the file.
How do you indicate the relative link to the same directory?
It is indicated by just the name of the file.
What is the purpose of an HTML form element?
To let users input data or information and allows us to collect that data.
Give five examples of form control elements.
form, input, text area, select (drop down list box), button, labels
Give three examples of type attributes for HTML elements.
text, password, radio, checkbox, file, submit, image
Is an HTML element a block element or an inline element?
It is an inline element.
What are the six primary HTML elements for creating tables?
table, tr(table row), td(table data), th(table heading), thead(heading of the table should sit inside), tbody(the body of the table should sit inside), tfoot(the footer of the table should sit inside)
What purpose do the thead and tbody elements serve?
It helps us distinguish what goes inside the heading of the table and the data that is inserted into the table. It also helps people who use screen readers.
Give two examples of data that would lend itself well to being displayed in a table.
A box score to a sports game, sales records for a company
What is the event.target?
the element where the event started from or dispatched from
Why is it possible to listen for events on one element that actually happen its descendent elements?
due to event bubbling
What DOM element property tells you what type of element it is?
event.target.tagName
What does the element.closest() method take as its argument and what does it return?
argument is a string containing a css selector and it returns the DOM element object that matches that selector
How can you remove an element from the DOM?
the remove method. call that on the element you want to remove
If you wanted to insert new clickable DOM elements into the page using JavaScript, how could you avoid adding an event listener to every new element individually?
by using event delegation. can use an if statement not equal to ‘element in capital letters / attaching it to the element that contains the element you are trying to manipulate