HTML Flashcards
Where do you put non-visible content about the HTML document?
In the head element
Where do you put visible content about the HTML document?
In the body element
Where do the < head > and < body > tags go in a valid HTML document?
In the html element
What is the purpose of a < !DOCTYPE > declaration?
To tell what type of document the file is and which version of html to use
What is the purpose of HTML attributes?
To attach extra information to elements
How do block-level elements affect the document flow?
Block elements starts on a new line, take up the entire width of the page and elements after it starts on a new line
How do inline elements affect the document flow?
Inline only takes up space as needed
What are the default width and height of a block-level element?
Width is 100% and height is auto
What are the default width and height of an inline element?
Width and height are auto
What is the difference between an ordered list and an unordered list in HTML?
Ordered lists is numbered and unordered lists use bullet points
Is an HTML list a block element or an inline element?
Block element
What HTML tag is used to link to another website?
Anchor tag
What is an absolute URL?
The full URL address
What is a relative URL?
A URL without the domain name, partial directory
How do you indicate the relative link to a parent directory?
../(file name)
How do you indicate the relative link to a child directory?
(child directory name)/(file name)
How do you indicate the relative link to a grand parent directory?
../../(file name)
How do you indicate the relative link to the same directory?
file name
What is the purpose of an HTML form element?
collect data from user
Is an HTML element a block element or an inline element?
inline
What are the six primary HTML elements for creating tables?
< table > , < thead > , < tbody > , < th > , < tr > , < td >
What purpose do the thead and tbody elements serve?
Organizing and formatting information
What are the names of the individual pieces of a CSS rule?
selector, declaration block, property, property value
In CSS, how do you select elements by their class attribute?
.(class name)
In CSS, how do you select elements by their type?
element name
In CSS, how do you select an element by its id attribute?
(id name)
What CSS properties make up the box model?
content, border, margin, padding
Which CSS property pushes boxes away from each other?
margin
Which CSS property add space between a box’s content and its border?
padding
What is a pseudo-class?
Defining a special state of an element
What are CSS pseudo-classes useful for?
styling elements in specific cases
What CSS property controls the font used for the text inside an element?
font-family
What is the default flex-direction of a flex container?
row
what is the default flex-wrap of a flex container?
no wrap
Why do two div elements “vertically stack” on one another by default?
div elements are block elements
What is the default flex-direction of an element with display: flex?
row
What is the default value for the position property of HTML elements?
static
How does setting position: relative on an element affect document flow?
Does not affect the flow
How does setting position: relative on an element affect where it appears on the page?
Does not affect the position of its appearance
How does setting position: absolute on an element affect document flow?
It takes it out of the flow
How does setting position: absolute on an element affect where it appears on the page?
It appears on the first non-static element from the parental hierarchy
How do you constrain an absolutely positioned element to a containing block?
make the containing block non-static
What are the four box offset properties?
top, bottom, left, right
What is the purpose of variables?
To hold values to be used later
How do you declare a variable?
var (variable name)
How do you initialize (assign a value to) a variable?
using the = assignment operator
What characters are allowed in variable names?
letters, numbers, $, _
What does it mean to say that variable names are “case sensitive”?
the variable must be spelled exactly or else it will be considered a different variable
What is the purpose of a string?
to hold any series of characters
What is the purpose of a number?
for calculation and counting
What is the purpose of a boolean?
for comparison that gives a define answer to determine the next course of action
What does the = operator mean in JavaScript?
to assign a value to a variable
How do you update the value of a variable?
assign the variable a new value
What is the difference between null and undefined?
null is purposely assigning no value, undefined is declaring a variable without assigning a value
Why is it a good habit to include “labels” when you log values to the browser console?
for other people and yourself to know which variables the values belong
What data type is returned by an arithmetic operation?
number
What is string concatenation?
combining strings to form one string
What purpose(s) does the + plus operator serve in JavaScript?
concatenating strings and adding numbers
What data type is returned by comparing two values (, ===, etc)?
boolean
What does the += “plus-equals” operator do?
adding/concatenating the value to the value of the variable
What are objects used for?
to organize data into groups without any specific order
What are object properties?
the variables in the object
Describe object literal notation.
{ properties }
How do you remove a property from an object?
using the delete operator
What are the two ways to get or update the value of a property
the . and []
What are arrays used for?
creating ordered lists of information
Describe array literal notation.
[]
How are arrays different from “plain” objects?
- information within the array has an order
- arrays do not have alpha numerical property names
What number represents the first index of an array?
0
What is the length property of an array?
returns how much elements are in the array
How do you calculate the last index of an array?
array.length - 1
What is a function in JavaScript?
A re-usable block of code that performs a specific task
Describe the parts of a function definition.
function keyword, function name(optional), parentheses, parameter, code block, return statement(optional)
Describe the parts of a function call.
function name with parentheses
When comparing them side-by-side, what are the differences between a function call and a function definition?
function call does not have the keyword function, does not have any code block, not followed by the {} and passes actual values
What is the difference between a parameter and an argument?
parameter is the name of the value and argument is the value being passed in
Why are function parameters useful?
it allows functions to be used in more than one way
What two effects does a return statement have on the behavior of a function?
function stops after reaching the return statement and the function must produce a value
Why do we log things to the console?
for debugging and checking the values
What is a method?
a function that is a property of an object
How is a method different from any other function?
it needs the object to access the method while a function doesn’t
How do you remove the last element from an array?
pop()