HTML Flashcards

1
Q

Where do you put non-visible content about the HTML document?

A

In the head element

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

Where do you put visible content about the HTML document?

A

In the body element

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

Where do the and tags go in a valid HTML document?

A

Siblings, children of HTML element

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

What is the purpose of a declaration?

A

To declare the type of the document.

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

Give five examples of HTML element types.

A

HTML, head, title, body, h1

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

What is the purpose of HTML attributes?

A

Provide additional information about the contents of an element

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

Give an example of an HTML entity (escape character).

A

© for copyrighted symbol

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

How do block-level elements affect the document flow?

A

They take up the width of the parent element. Push content on the left up and content on the right down.

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

How do inline elements affect the document flow?

A

Take up whatever space is needed for the content and doesn’t move any element around.

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

What are the default width and height of a block-level element?

A

The width and height of the parent

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

What are the default width and height of an inline element?

A

Width and height of whatever space is needed for the content.

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

What is the difference between an ordered list and an unordered list in HTML?

A

An ordered list has numbers labeled in ordered pairs while an unordered list has bullet points.

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

Is an HTML list a block element or an inline element?

A

block

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

What HTML tag is used to link to another website?

A

Anchor

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

What is an absolute URL?

A

A direct address

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

What is a relative URL?

A

Shorthand name for the file within directory.

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

How do you indicate the relative link to a parent directory?

A

../

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

How do you indicate the relative link to a child directory?

A

/

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

How do you indicate the relative link to a grand parent directory?

A

../../

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

How do you indicate the relative link to the same directory?

A

file name

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

What is the purpose of an HTML form element?

A

To collect info from the user

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

Give five examples of form control elements

A

Select, textarea, form, button, radio

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

Three examples of type attribute values for HTML input elements

A

Text, radio, checkbox

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

Is HTML element a block element or an inline element?

A

Inline block element

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

What are the six primary HTML elements for creating tables?

A

table, thead, tr, td, tbody, th, tfoot

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

What purpose do the thead and tbody elements serve?

A

thead is for headings while body is for every other content

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

What are the names of the individual pieces of a CSS rule?

A

rulesets

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

In CSS, how do you select elements by their class attribute?

A

by placing a period at the start

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

In CSS, how do you select elements by their tag name?

A

with their tag name

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

In CSS, how do you select an element by its id attribute?

A

with the pound sign followed by attribute value

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

What CSS properties make up the box model?

A

border, margin, padding, and content

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

Which CSS property pushes boxes away from each other?

A

margin

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

Which CSS property add space between a box’s content and its border?

A

padding

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

What is a pseudo class?

A

Keyword to change an element when it is in a certain state

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

What are the CSS pseudo-classes useful for

A

help the user with visual feedback

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

Name two types of units that can be used to adjust font-size in CSS.

A

px and em

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

What CSS property controls the font used for the text inside an element?

A

font-family

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

what is the default flex-direction of a flex container?

A

row

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

what is the default flex-wrap of a flex container?

A

nowrap

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

Why do two div elements “vertically stack” on one another by default?

A

because they are display:block

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

What is the default value for the position property of HTML elements?

A

static

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

How does setting position: relative on an element affect document flow?

A

the. document flow. like the element was never changed.

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

How does setting position: relative on an element affect where it appears on the page?

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

How does setting position: absolute on an element affect document flow?

A

removes element from document flow

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

How does setting position: absolute on an element affect where it appears on the page?

A

it is out of the document flow

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

How do you constrain an absolutely positioned element to a containing block?

A

put it in a nonstatic ancestor

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

What are the four box offset properties?

A

distances from top bottom left and right

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

What is the default value for the position property of HTML elements?

A

static

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

How does setting position: relative on an element affect document flow?

A

the document flow stays the same

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

How does setting position: relative on an element affect where it appears on the page?

A

it depends on how you choose to position it in relation to it’s original position

51
Q

How does setting position: absolute on an element affect document flow?

A

it takes the element out of the flow

52
Q

How does setting position: absolute on an element affect where it appears on the page?

A

positions its pixels from the side you set

53
Q

How do you constrain an absolutely positioned element to a containing block?

A

put it to a non static parent

54
Q

What does it mean to say that variable names are “case sensitive”?

A

capitalization needs to stay consistent

55
Q

What is the purpose of a string?

A

To have text that the computer can read

55
Q

What is the purpose of a string?

A

To have text that the computer can read

56
Q

What is the purpose of a number?

A

math operations

57
Q

What is the purpose of a boolean?

A

decision making

58
Q

What characters are allowed in variable names?

A

letters, numbers not at the start, $, underscores,

59
Q

How do you initialize (assign a value to) a variable?

A

keyword for variable, variable name, assignment operator, and value

60
Q

How do you declare a variable?

A

keyword for variable, variable name, assignment operator, and value

61
Q

What does the = operator mean in JavaScript?

A

assignment operator

62
Q

What is the purpose of variables?

A

to store values

63
Q

How do you update the value of a variable?

A

define another variable without keyword

64
Q

What is the difference between null and undefined?

A

null is a placeholder value, undefined has no value.

null has to be defined, it is how a programmer says empty.
undefined is how javascript says empty

65
Q

Why is it a good habit to include “labels” when you log values to the browser console?

A

easier to organize

66
Q

Why is it a good habit to include “labels” when you log values to the browser console?

A
67
Q

What data type is returned by an arithmetic operation?

A

numerical value

68
Q

What is string concatenation?

A

combing two strings together to make a new string

69
Q

What purpose(s) does the + plus operator serve in JavaScript?

A

to add numbers and concatenate strings

70
Q

What data type is returned by comparing two values (<, >, ===, etc)?

A

boolean

71
Q

What are objects used for?

A

to store info in a more flexible way

gives you the ability to store multiple pieces of data in one name

72
Q

What are object properties?

A

variables that part of an object

73
Q

Describe object literal notation.

A

keyword variable name assignment operator to curly braces, operators are made by a name, colon, then data. properties are separated by commas

74
Q

How do you remove a property from an object?

A

delete operator

75
Q

What are arrays used for?

A

to have a list of data

76
Q

Describe array literal notation.

A

square bracket with values separated by commas

77
Q

How are arrays different from “plain” objects?

A

index values are different, to add to an object you assign it like a variable, whereas in arrays you have to use the push method.

78
Q

What number represents the first index of an array?

A

0

79
Q

What is the length property of an array?

A

gets how many items are in an array

80
Q

How do you calculate the last index of an array?

A

array length - 1

81
Q

What is a function in JavaScript?

A

list of steps that can be reused multiple times

82
Q

Describe the parts of a function definition.

A

function keyword, optional name, parameter list, opening curly brace, code block, closing curly brace

83
Q

Describe the parts of a function call.

A

function name, followed by parentheses with optional arguments

84
Q

When comparing them side-by-side, what are the differences between a function call and a function definition?

A

a definition says function and curly brace, while a call only has function name and parenthesis

85
Q

What is the difference between a parameter and an argument?

A

parameter is a placeholder for the future value, argument is the actual value. parameter is used when you are defining a function while arguments are used when you are calling the function

86
Q

Why are function parameters useful?

A

create variables within function

87
Q

What two effects does a return statement have on the behavior of a function?

A

allows the rsult of the function to be used out of the function and exits the function

88
Q

Why do we log things to the console?

A

to see the state of our code

89
Q

What is a method?

A

function in an object

90
Q

How is a method different from any other function?

A

it belongs to an object. prepend it with dot and name of object

91
Q

How do you remove the last element from an array?

A

pop method

92
Q

How do you round a number down to the nearest integer?

A

floor method of math object

93
Q

How do you generate a random number?

A

random method of math object

94
Q

How do you delete an element from an array?

A

splice method

95
Q

How do you append an element to an array?

A

push

96
Q

How do you break a string up into an array?

A

split method

97
Q

Do string methods change the original string? How would you check if you weren’t sure?

A

they do not, and console.log to check

98
Q

Do string methods change the original string? How would you check if you weren’t sure?

A

they do not, and console.log to check

99
Q

Roughly how many string methods are there according to the MDN Web docs?

A

50

100
Q

Is the return value of a function or method useful in every situation?

A

no

101
Q

Roughly how many array methods are there according to the MDN Web docs?

A

a lot

102
Q

What three-letter acronym should you always include in your Google search about a JavaScript method or CSS property?

A

mdn

103
Q

Give 6 examples of comparison operators.

A

> < >= <= == ===

104
Q

What data type do comparison expressions evaluate to?

A

boolean

105
Q

What is the purpose of an if statement?

A

allows us to make branching decisions

106
Q

Is else required in order to use an if statement?

A

no

107
Q

Describe the syntax (structure) of an if statement.

A

if statement, parenthesis, condition, curly braces for code

108
Q

What are the three logical operators?

A

||, &&, !

109
Q

What is the purpose of a loop?

A

to repeat an action

110
Q

What is the purpose of a condition expression in a loop?

A

dictate when the loop stops

111
Q

What does “iteration” mean in the context of loops?

A

one repetition

112
Q

When does the condition expression of a while loop get evaluated?

A

before the code block on each iteration

113
Q

When does the initialization expression of a for loop get evaluated?

A

at the beginning of a loop once

114
Q

When does the condition expression of a for loop get evaluated?

A

before each loop iteration

115
Q

When does the final expression of a for loop get evaluated?

A

after the code block is ran

116
Q

Besides a return statement, which exits its entire function block, which keyword exits a loop before its condition expression evaluates to false?

A

break

117
Q

What does the ++ increment operator do?

A

increment one

118
Q

What are the four components of “the Cascade”.

A

source order, specificity, and inheritance

119
Q

What does the term “source order” mean with respect to CSS?

A

the order in which rulesets are declared

120
Q

How is it possible for the styles of an element to be applied to its children as well without an additional CSS rule?

A

yes, inheritance

121
Q

List the three selector types in order of increasing specificity.

A

type, class, and id

122
Q

Why is using !important considered bad practice?

A

strongest way to style, if u use it often it can make your code less flexible

123
Q

what does the transform css property do?

A

it allows you to rotate, scale, skew or translate an element?