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?
within the html tags
What is the purpose of a DOCTYPE declaration?
declare the version of HTML being used
Give 5 examples of HTML element tags.
p, head, body, html, span
What is the purpose of HTML attributes?
They give us more information about the element
Give an example of an HTML entity (escape character)
®
How do block-level elements affect the document flow?
they start a new line
How do inline elements affect the document flow
they are on the same line
what are the default width and height of a block-level element?
width = 100% (of container) height = auto
What are the default width and height of an inline element?
both auto
What is the difference between an ordered and unordered list in HTML?
ordered are numbered, unordered are not
Is an HTML list a block or inline element?
block
What HTML tag is used to link to another website?
anchor tag (a)
What is an absolute URL?
external navigation, nav to another site
What is a relative URL?
internal navigation, nav within your site
How do you indicate the relative link to a parent directory?
../parent
How do you indicate the relative link to a child directory?
child/wherever
How do you indicate the relative link to a grand parent directory?
../../grand parent
How do you indicate the relative link to the same directory?
just type name of desired file
What is the purpose of an HTML form element?
Collect user input/information
Give five examples of form control elements.
input, text area, select, option, button
Give three examples of type attributes for HTML input elements.
submit, file, radio, checkbox, password, text
Is an HTML input element a block or inline element?
inline
What are the 6 primary HTML elements for creating tables?
table, thead, tbody, tr, td, tfoot
What purpose do the thead and tbody elements serve?
organizational purpose
Give two examples of data that would lend itself well to being displayed in a table.
sport scores, grades, any tabular data
What are the names of the individual pieces of a CSS rule?
selector, declaration block, property, value
In CSS, how do you select elements by their class attribute
.classname
In CSS, how do you select elements by their type?
type name
In CSS, how do you select an element by its id attribute?
idname
Name three different types of values you can use to specify colors in CSS.
hex code, RGB, color name, RGBA, HSL (hue saturation and luminosity), HSLA
What CSS properties make up the box model?
border, padding, margin
Which CSS property pushes boxes away from eachother?
margin
Which CSS property add space between a box’s content and its border?
padding
What is a pseudo-class
classes applied by browser based on certain state
What are CSS pseudo-classes useful for?
style without adding classes to elements/updating HTML
Name at least two units of type size in CSS
px, em, rem
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?
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?
it doesnt
How does setting position: relative on an element affect where it appears on the page?
no movement without any other changes
How does setting position: absolute on an element affect document flow:
its removed from the document flow
How does setting position: absolute on an element affect where it appears on the page?
It starts in the container of its closest non-static, parent element.
How do you constrain an absolutely positioned element to a containing block?
set the containing block to something other than static (relative)
What are the four box offset properties?
top, right, bottom, left
What is the purpose of variables?
To store values. Can change and update and data permanence.
How do you declare a variable?
Var name;
How do you initialize (assign a value to) a variable?
var name = “value”;
What characters are allowed in variable names?
letter, _, $, numbers (not as first character)
What does it mean to say that variable names are “case sensitive”?
case matters
What is the purpose of a string?
Store or manipulate text
What is the purpose of a number?
Math and number quantities
What is the purpose of a boolean?
“on and off switch”, store true and false values. exist for decision making.
What does the = operator mean in JS?
assignment operator
How do you update the value of a variable?
dont need var, just assign variable a new value
What is the difference between null and undefined?
null always needs to be assigned as a value, intentional “empty” value. Undefined is “empty” from JS engine, unintentional, devs dont use it, signifies something went wrong.
Why is it a good habit to include “labels” when you log values to the browser?
Give a point of reference
What data type is returned by an arithmetic operation?
number
What is string concatenation?
combining of strings
What purpose(s) does the + operator serve in JS?
addition, combination
What purpose(s) does the + operator serve in JS?
addition, concatenation
What does the += operator do?
adds the values and makes the result equal to the first variable
What are objects used for?
store several properties
What are object properties?
similar to a variable for objects
Describe object literal notation?
curly braces to open and close, properties and values inside
How do you remove a property from an object?
delete keyword
What are the two ways to get or update the value of a property?
bracket, or dot notation
What are arrays used for?
Store index/value pairs, ordered lists of data.
Describe array literal notation.
square brackets, data separated by commas
How are arrays different from “plain” objects?
index/value pairs instead of key/value pairs
What number represents the first index of an array?
0
What is the length property of an array?
gives a number value for items in an array
How do you calculate the last index of an array?
array.length - 1
What is a function in JS?
instructions to perform a task
Describe the parts of a function definition
function name(parameters) { code block }
Describe the parts of a function call
name(arguments)
When comparing, what are the differences between a function call and definition?
Definition needs function keyword, definition has parameters and includes code block.
What is the difference between a parameter and an argument?
parameter is a placeholder, argument is data being passed into the function when called
Why are function parameters useful?
placeholders for values
What two effects does a return statement have on the behavior of a function
returns result of code block expression, ends function
Why do we log things to the console?
To check our work
What is a method?
A function that is a property of an object
How is a method different from any other function
syntax
How do you remove the last element from an array?
pop()
How do you round a number down to the nearest integer?
Math.floor()
How do you generate a random number?
Math.random()
How do you delete and element from an array?
splice, shift, pop
How do you append an element to an array?
push()
Do string methods change the original string? How would you check if you werent sure?
no, strings are immutable
Do string methods change the original string? How would you check if you werent sure?
no, strings are immutable. Check MDN
Roughly how many string methods are there according to MDN Web docs?
a lot
Is the return value of a function of method useful in every situation?
no (example, splice returns deleted values. may be useful, may not)
Roughly how many array methods are there according to the MDN Web doc?
a lot
What three-letter acronym should you always include in your google search about a JavaScript method or CSS property
MDN
Give 6 examples of comparison operators
, &&, ||, <=, >=
What data type do comparison expressions evaluate to?
boolean
What is the purpose of an if statement?
condition
Is else required in order to use an if statement?
no
Describe the syntax (structure) of an if statement.
if () {
}
What are the three logical operators?
and, or, not
How do you compare two different expressions in the same condition?
using and, or operators
What are the four components of “The Cascade”
inheritance, specificity, source order, important
How is it possible for the styles of an element to be applied to its children as well without an additional CSS rule?
inheritance allows child elements to use styling from parent elements
List three selector types in order of increasing specificity
type, class, id
weakest—> strongest
Why is using !important considered bad practice?
interrupts the cascade flow
What does the express.json() middleware do and when would you need it?
Parses JSON payload (body) of incoming requests.
You would need it when receiving JSON type data/ objects
What is the significance of an HTTP request’s method?
Determines the functionality