HTML Flashcards

1
Q

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

A

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

Within the body element

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

What is the purpose of a <!DOCTYPE> declaration?

A

To show the version of the language

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

Give five examples of HTML element types.

A

HTML element, Body element, P element, head element, title element, h1 element

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

What is the purpose of HTML attributes?

A

It indicates what kind of extra information you are supplying about the element’s content, it should be written in lowercase

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

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

A

< less than
> greater than
& ampersand

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

How do block-level elements affect the document flow?

A

They always appear to start on a new line in the browser window

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

How do inline elements affect the document flow?

A

They always appear to continue on the same line as their neighboring elements

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

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

A

height: auto
width: 100%

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 an inline element?

A

weight: auto
height: auto

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

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

A

Ordered lists use numbers
Unordered lists use bullets

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

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

A

Block element

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

What HTML tag is used to link to another website?

A

a element which has an attribute called href

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

What is an absolute URL?

A

Starts with the domain name for that site, and can be followed by the path to a specific page

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

What is a relative URL?

A

A shorthand version of the absolute urls because you do not need to specify the domain name.

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

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

A

Use ../ to indicate the folder above the current one, then follow it with the file name.

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 child directory?

A

For a child folder, use the name of the child folder, followed by a forward slash, then the file name.

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 grand parent directory?

A

Repeat the ../ to indicate that you want to go up two folders(rather than one) then follow it with the file name

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 the same directory?

A

To link to a file in the same folder, just use the file name. (Nothing else is needed)

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

What is the purpose of an HTML form element?

A

it sets up the boundary of the form and it gives you a set of elements to collect data from your users

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

Give five examples of form control elements.

A

<input></input> element

<text> element
<select> element
<option> element
<button> element
<legend> element
</legend></button></option></select></text>

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

Give three examples of type attribute values for HTML <input></input> elements.

A

<action> attribute
<id> attribute
<size> attribute
type=”text” attribute
maxlength attribute
<value> attribute
<checked> attribute
</checked></value></size></id></action>

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

Is an HTML <input></input> element a block element or an inline element?

A

It is an inline because its able to have the same content in the same line

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

What are the six primary HTML elements for creating tables?

A

<table>
<tr>
<td>
<th>
<thead>
<tbody>
<tfoot>
</tfoot></tbody></thead></th></td></tr></table>

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

What purpose do the thead and tbody elements serve?

A

Thead-The <thead> HTML element defines a set of rows defining the head of the columns of the table.
tbody-

The <tbody> HTML element encapsulates a set of table rows (<tr> elements), indicating that they comprise the body of the table (<table>).

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

Give two examples of data that would lend itself well to being displayed in a table.

A

Financial reports, tv schedules, sports results

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

A selector and a declaration block, property and value

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 putting a Period symbol before the name of the class

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

Matches element tag names

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

By using the #, pound sign or hash symbol.

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

Name three different types of values you can use to specify colors in CSS.

A

RGB Values
Hex codes
Color names

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

What CSS properties make up the box model?

A

The box model consists of: margins, borders, padding, and the actual content (width & height).

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
33
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
34
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
35
Q

What is a pseudo-class?

A

It is a keyword added to a selector that specifies a special state of the selected element(s)

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

What are CSS pseudo-classes useful for?

A

They let you apply a style to an element not only in relation to the content of the document tree, but also in relation to external factors like the history of the navigator.

Ex. User interaction

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

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

A

Pixels, rem

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

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

A

Font family property

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
39
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
40
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
41
Q

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

A

Because they are block elements

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

What is the default flex-direction of an element with display: flex?

A

row

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

What are the three primary components of a page layout? (Which helper classes do you need?)

A

Column row and container

44
Q

What is the minimum number of columns that you should put in a row?

A

1

45
Q

What is the purpose of a container?

A

expands items to fill available free space or shrinks them to prevent overflow.

46
Q

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

A

static

47
Q

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

A

It is unaffected, elements sit in the same spot.

48
Q

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

A

Relative position moves an element in relation to where it would have been in normal flow.

49
Q

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

A

This positions the element in relation to its containing elementWhen the position property is given a value of absolute, the box is taken out of normal flow and no longer affects the position of other elements on the page

50
Q

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

A

It is positioned to the nearest non static parent

51
Q

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

A

anything other than static

52
Q

What are the four box offset properties?

A

Top,bottom, left, right

53
Q

What is the purpose of variables?

A

Serves as a container for values or any data that you want the computer to remember. So that you can utilize it later.

54
Q

How do you declare a variable?

A

You need a variable keyword and a variable name in camelCase.

55
Q

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

A

By using the assignment operator. Variable name on the left and the value of the variable on the right.

56
Q

What characters are allowed in variable names?

A

Letters, numbers, underscores, $, variable cannot begin with a number.

57
Q

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

A

Uppercase and lowercase. For example, score and Score would be different variable names.

58
Q

What is the purpose of a string?

A

A way to store “text” information. A series of characters.

59
Q

What is the purpose of a number?

A

to allow us to solve arithmetic problems

60
Q

What is the purpose of a boolean?

A

Allow us to make decisions in code. Only Two possible values. true and false.

61
Q

What does the = operator mean in JavaScript?

A

Assignment.

62
Q

How do you update the value of a variable?

A

By changing the value of of the variable. Variable name assignment operator, the new value.

63
Q

What is the difference between null and undefined?

A

Null is empty, but will put something there later. Null is Purposeful emptiness in the hands of the developer.
Undefined is accidental emptiness.

64
Q

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

A

To make the values you’re logging in the browser more clear to understand.

65
Q

Give five examples of JavaScript primitives.

A

Numbers, Booleans, strings, null, undefined,

66
Q

What data type is returned by an arithmetic operation?

A

Numbers

67
Q

What is string concatenation?

A

Joins together two or more strings to create one new string

68
Q

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

A

Adds one value to another and/or concatenate strings.

69
Q

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

A

Boolean

70
Q

What does the += “plus-equals” operator do?

A

adds the value of the right operand to a variable and assigns the result to the variable.

71
Q

What are objects used for?

A

Objects group together a set of variables and functions under one box. Stores multiple information that are attributed to one thing.

72
Q

What are object properties?

A

Individual pieces of named data within an object

73
Q

Describe object literal notation

A

Var obj = {};

74
Q

How do you remove a property from an object?

A

Delete operator

75
Q

What are the two ways to get or update the value of a property?

A

Dot notation, bracket notation

76
Q

What are arrays used for?

A

It stores a list of values.

77
Q

Describe array literal notation.

A

You need a variable key word followed by the name of the array, the values assigned for the array are inside a pair of square brackets. Each value is separated by a comma

78
Q

How are arrays different from “plain” objects?

A

You use arrays when the list order matters. Values of an array are all the same data type. Objects can hold different data. Arrays have a length property. Objects don’t have any property.

79
Q

What number represents the first index of an array?

A

0

80
Q

What is the length property of an array?

A

True count of how many items are in the array.

81
Q

How do you calculate the last index of an array?

A

array.length-1

82
Q

What is a function in JavaScript?

A

Functions allow you to package up code for use later in your program.
A set of actions that can be repeated.

83
Q

Describe the parts of a function definition.

A

Function definitions are made of:
the function keyword
an optional name
zero or more parameters
a code block
an optional return statement

84
Q

Describe the parts of a function call.

A

Notice that we are simply writing the name of the function and placing () parentheses next to it. Functions are called with () parentheses and passed zero or more arguments.

85
Q

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

A

Function definition has parameters and a function call has arguments. Function definition has curly braces.

86
Q

What is the difference between a parameter and an argument?

A

parameters are listed inside the parentheses () in the function definition. arguments are the values received by the function when it is called.

when we define a function, we declare parameters and that when we call a function, we pass it arguments

87
Q

Why are function parameters useful?

A

They are use a placeholders for the values you will be calling in your function. It allows us to have variants of how a code runs. You can introduce new values to get different results.

88
Q

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

A

A return statement causes the function to produce a value.
A return statement also exits the function; no code after the return statement is executed.

89
Q

Why do we log things to the console?

A

The JavaScript console is a debugging tool. It is where the browser prints errors and warnings as they occur in your JavaScript code. Verification. Landmark to watch your process execute.

90
Q

What is a method?

A

A method is a function which is a property of an object.

91
Q

How is a method different from any other function?

A

They always have dot before. Functions do not utilize the dot notation.

92
Q

How do you remove the last element from an array?

A

Pop method.

93
Q

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

A

Floor method of the math object.

94
Q

How do you generate a random number?

A

Math random method

95
Q

How do you delete an element from an array?

A

Splice method

96
Q

How do you append an element to an array?

A

Push method

97
Q

How do you break a string up into an array?

A

Split method

98
Q

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

A

They do not change. They are immutable. You can check by calling the string method

99
Q

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

A

No.

100
Q

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

A

MDN

101
Q

Give 6 examples of comparison operators.

A

== is equal to
!= is not equal to
> greater than
< less than
=== strictly equal to
!== strict not equal to
>= greater than or equal to
<= less than or equal to

102
Q

What data type do comparison expressions evaluate to?

A

Booleans

103
Q

What is the purpose of an if statement?

A

The determine which path to take. It allows us to make decisions in our code.

104
Q

Is else required in order to use an if statement?

A

no

105
Q

Describe the syntax (structure) of an if statement.

A

“If” keyword, a condition, opening curly brace, code to execute if value is true, and a closing curly brace.

106
Q

What are the three logical operators?

A

&& logical and
|| logical or
! logical not

107
Q

How do you compare two different expressions in the same condition?

A

Use logical and or