HTML-CSS-JS Flashcards
Where do you put non-visible content about the HTML document?
in the element
Where do you put visible content about the HTML document?
in the element
Where do the and tags go in a valid HTML document?
in the element
What is the purpose of a declaration?
it tells the browser what type of document it is looking at, so it knows what to do with it
Give five examples of HTML element tags:
"<p>" - paragraph "</p><h1>" heading biggest size "" main body "" the title, what you see on the tab "" the opening tag of an entire html doc "<div>"</div></h1>
What is the purpose of HTML attributes?
they provide additional information about an element.
Give an example of an HTML entity (escape character)
< - less than sign
How do block-level elements affect the document flow?
take up all the width of its parent element
How do inline elements affect the document flow?
takes up as much space as their content
What are the default width and height of a block-level element?
block element takes up the full width available to it and the height is equal to its contents
What are the default width and height of an inline element?
the height and width is determined by the boundary of its element tags.
What is the difference between an ordered list and an unordered list in HTML?
Ordered list shows a list using numbers <ol>
Unordered shows a list using bullet points </ol><ul></ul>
Is an HTML list a block element or an inline element?
a list is a block element
What HTML tag is used to link to another website?
<a> </a>
anchor element
attribute href with the value of an absolute/relative URL to —
What is an absolute URL?
Absolute URL is a link to another website
What is a relative URL?
relative URL is linking to another page within the same site
How do you indicate the relative link to a parent directory?
href=”../folder-file name”
How do you indicate the relative link to a child directory?
href=”folder name/file name”
How do you indicate the relative link to a grand parent directory?
href=”../../file name”
How do you indicate the relative link to the same directory?
href=”file name”
What is the purpose of an HTML form element?
allows you to collect user input
Give five examples of form control elements.
adding text, radio buttons, checkboxes, drop-down boxes, submit buttons
Give three examples of type attributes for HTML elements.
submit, checkbox, radio
Is an HTML element a block element or an inline element?
inline element
What are the six primary HTML elements for creating tables?
- table row
- table data
- a cell header
- headings of a table sits inside
- the table body sits inside
What purpose do the thead and tbody elements serve?
They help distinguish between the main content of the table and first row
Give two examples of data that would lend itself well to being displayed in a table
schedules, sports results, fiances, data
What are the names of the individual pieces of a CSS rule?
selector, declaration {property:value;}
In CSS, how do you select elements by their class attribute?
.name of class
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
Name three different types of values you can use to specify colors in CSS.
color name - from 147 selections
hex code
rgb value
What CSS properties make up the box model?
margin, padding, border
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?
a keyword added to a selector that specifies a special state of the selected element.
What are CSS pseudo-classes useful for?
They’re useful for helping the user interact with the page. To allow the user some visual representation of what they’re doing or that something is interact-able
Name at least two units of type size in CSS.
px
em
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?
nowrap - all flex items will be on one line
Why do two div elements “vertically stack” on one another by default?
because they’re block-level
What is the default flex-direction of an element with display: flex?
row - left to right
How does setting position: absolute on an element affect document flow?
it takes the element out of normal flow, and other elements can take its place. Other elements will move into its space.
How does setting position: absolute on an element affect where it appears on the page?
It looks for a non-static positioned parent to align to.
How do you constrain an absolutely positioned element to a containing block?
set a non-static position to the parent you want it to align to.
What are the four box offset properties?
top, bottom, right, left
What is the purpose of variables?
to remember specific values, to store or manipulate later
How do you declare a variable?
in the js file
var variableName;
How do you initialize (assign a value to) a variable?
after you declare
variableName = X
What characters are allowed in variable names?
letters, $, or _ to start
numbers and letters, _ inside
no - or . in a name
What does it mean to say that variable names are “case sensitive”?
the name of the variable needs to match its name exactly, so runFaster is not the same as runfaster.
What is the purpose of a string?
to have text content as a value of a variable. Literal representation of characters.
What is the purpose of a number?
math, size of a screen, moving the position of something on screen. Setting time.
Hold and represent numerical data.
What is the purpose of a boolean?
to hold either true or false.
What does the = operator mean in JavaScript?
assignment operator, assign a value to something
How do you update the value of a variable?
by assigning it a new value
What is the difference between null and undefined?
null is an intentionally nonexistent or invalid object.
undefined is something that has a variable that is only declared and not assigned a value.
Why is it a good habit to include “labels” when you log values to the browser console?
labels help to distinguish what is being logged to the console if you have multiple console logs.
Give five examples of JavaScript primitives.
null, undefined, boolean, string, number
What data type is returned by an arithmetic operation?
number
What is string concatenation?
combining two or more strings to make a longer string.
What purpose(s) does the + plus operator serve in JavaScript?
to add two things together, either by concatenation or numerically
What data type is returned by comparing two values (, ===, etc)?
boolean, true or false
What does the += “plus-equals” operator do?
it adds the value of the right operand to a variable and assigns the results to the variable.
What are objects used for?
grouping together sets of variables and functions to create a model of something you would recognize in the real world.
What are object properties?
properties are variables
Describe object literal notation.
it is creating an object by first typing
var objectName = {
propertyName: propertyValue,
};
How do you remove a property from an object?
using the delete operator
delete objectName.propertyName
What are the two ways to get or update the value of a property?
dot notation
objectName.propertyName = propertyValue;
bracket notation
objectName[‘propertyName’] = propertyValue;
What are arrays used for?
lists or sets of values that are related to each other
Describe array literal notation.
var arrayName = [‘arrayValue1’,’arrayValue2’]
How are arrays different from “plain” objects?
are numerically indexed
What number represents the first index of an array?
0
What is the length property of an array?
arrayName.length - it tells you the amount of values in the array.
How do you calculate the last index of an array?
(arrayName.length - 1)
What is a function in JavaScript?
A small program that can be called and reused for a number of different situations.
Describe the parts of a function definition.
function keyword optional name parameters code block optional return statement end of the function code block
Describe the parts of a function call.
typing the function keyword and its parameters.
When comparing them side-by-side, what are the differences between a function call and a function definition?
A call uses a function already defined, while a definition is creating a function to be called
What is the difference between a parameter and an argument?
parameter is a placeholder for arguments
Why are function parameters useful?
allow us to give data to functions
What two effects does a return statement have on the behavior of a function?
- Causes the function to produce a value we can use
2. Prevents any more code in the functions code block from being run.
Why do we log things to the console?
To test our JS
What is a method?
a Function that is a property of an object.
How is a method different from any other function?
methods are called to/from an object
How do you remove the last element from an array?
pop() method, removes the last element from an array
How do you round a number down to the nearest integer?
Math.floor() method
How do you generate a random number?
Math.random() creates a # 1 or 0, to make a larger random number it must be multiplied by another number.
How do you delete an element from an array?
splice(index starting #, how many elements to remove)
How do you append an element to an array?
push() method adds one or more elements to the end of an array.
How do you break a string up into an array?
split() method
Do string methods change the original string? How would you check if you weren’t sure?
String methods do not change the original string. Strings are immutable, so any changes to strings are actually new strings.
log the console object
Roughly how many string methods are there according to the MDN Web docs?
50
Is the return value of a function or method useful in every situation?
no
Roughly how many array methods are there according to the MDN Web docs?
38
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.
> less then > greater then >= greater then or equals <= less then or equals === strictly equals != is not equal to == equals !== strictly not equal
What data type do comparison expressions evaluate to?
boolean
What is the purpose of an if statement?
What is the purpose of an if statement?
to determine if the condition is true or false
Is else required in order to use an if statement?
no
Describe the syntax (structure) of an if statement.
if keyword
condition
curly brace - code to execute if value is true - closing curly brace
What are the three logical operators?
|| one is true - logical or
&& both are true - logical and
! - logical not - inverts the boolean value
How do you compare two different expressions in the same condition?
put them in parenthesis and use a logical operator
What is the purpose of a loop?
Loops check a condition, until the condition returns false.
Loops allow us to create a code block and repeat it as fast as the computer can do it.
What is the purpose of a condition expression in a loop?
It tells the loop when to stop running
What does “iteration” mean in the context of loops?
one full pass through a loop. The code block running one time.