Advanced Web Developer Bootcamp - Colt Steele Flashcards

1
Q

What are CSS transitions?

A

Makes it possible to do basic animation, by transitioning 1 or more CSS properties from one value to another.

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

Explain two ways of implementing CSS transitions

A

CSS only:

The base CSS class should contain properties such as transition-* properties and the default values that will be transitioned. Then a second CSS class, with a pseudo-class selector should apply the final transition property values. The pseudo class selector can also use transform and translate properties. All properties from the pseudo class that change between the base class and the pseudo class will be transitioned by default.

`
.card{
height:100px;
background-color:red;
transition-duration:200ms;
}

.card:hover{
background-color:blue;
}`

With Javasript:

The same EXCEPT, a pseudo class is not used, but rather Javascript is used to a assign such a class to an element.
`
.card{
height:100px;
background-color:red;
transition-duration:200ms;
}

.card-transitioned{
background-color:blue;
}

window.setTimeout(()=>{
document.getElementsByClassName(‘card’)[0].classList.add(‘card-transitioned’);
},1000)
`

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

Transition properties

A

transition-duration: how long it takes

transition-property: opacity, height… :which properties to transition, by default ‘all’
transition

transition-delay: how long to wait before starting transition

transition-timing-function: The bezier curve to use for the animation OR values such as ease-in, ease-out etc

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

Explain performance concerns with regards to CSS transitions

A

There are a plethora of properties that can be transitioned, however, for best performance, these are recommended:
`
transform: rotate()
transform: scale()
transform: translate()
opacity
`

The reason is that transforms and opacity come right at the end of the rendering process that the browser uses. If height for example has to change, then there is a waterfall effect, where the browser has to do layout-> paint -> composite layers (transforms and opacity). If only transforms or opacity, then only the composite layers step is required.

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

Explain transforms

A

The transform property allows transforming a selected element by moving it around with translate(), scaling it, rotating it.

transform-origin, can be set to determine where the transform is pinned to when changing the scale for example. By default it is in the center.

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

Explain :active

A

It’s a pseudo class for when the mouse button is held down on any element.

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

Explain :focus

A

When a form element, button or field, receives focus.

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

What are keyframes

A

Allows a developer to create more complex animations with more than just transitioning from 1 value to another.

You can set propertie(s) values at different intervals. For example, at 10%, 50%, 80%, 100% etc.

You can also repeat the animation.

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

Basic keyframes implementation and explanation

A

The animation is created and named using the @keyframes name{
[%]{
properties
}
}

The animation is then used and manipulated via the animation-* properties.

@keyframes animatedBall {
0%{
background-color:green;
}
20%{
background-color:red;
transform:translateY(100px);
}
70%{
transform:translateY(300px);
background-color:orange;
}
}

.ball{
height:100px;
width:100px;
animation-name: animatedBall;
animation-duration: 1000ms;
animation-fill-mode: backwards;
animation-iteration-count: 3;
}

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

Some important keyframes animation properties

A

animation-name: the keyframe animation name
animation-duration: how long
animation-fill-mode: what to do once the animation is stopped
animation-iteration-count: how many repetitions.

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

The x, y axis for translate

A

-x +x

-y
+y

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

JWTs (JSON Web Tokens)

A

Signed JWTs are used for authentication and authorization.

Authentication - ensure that it’s a valid request, JWT is valid

Authorization - middle-ware on the server is meant to authorize users with certain permissions/roles to access certain routes. The JWT is used to determine the user.

JWT is a token that is sent as an Authorization Header Bearer Token by convention to the API.

The API can decode the JWT in order to determine the user using the payload saved within the JWT.

The server issues the JWT, with information such as the user data, encrypted in the JWT. The front-end sends it to the API with every request. The API decrypts it to get the payload in order to determine the user. When the JWT is created and decrypted, a secret (password) is used.

Signed token structure:

header.payload.signature

  • header: contains the algorithm used for encryption and decryption
  • payload: contains claims, some are standard, but you can add custom claims, such as data about the user
  • signature: this verifies the validity of the JWT
  • header:
    `
    {
    “alg”: “HS256”,
    “typ”: “JWT”
    }
    `

base64url encoded in order to create header string

  • payload

Registered claims that are not mandatory but are standard claims such as issuer, expiry, audience etc

Private claims: custom claims such as
{ userid:1233 }

Also base64url encoded to form second string

Signature:

Use algorithm defined in the head

`
HMACSHA256(
base64UrlEncode(header) + “.” +
base64UrlEncode(payload),
secret)
`

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

What are the building blocks of flexbox layouts

A

The flex container (with display:flex), and flex-items (the children of the container)

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

Important properties on flex container

A

display:flex - makes it a flex container

flex-direction: the direction can be row or column. Defaults to row, meaning the flex items are displayed in a row by default. This sets the main axis as this value. The cross axis is the opposite value.

justify-content: how flex items are spaced along the main axis, if there is space that is not fully taken up by the flex items via flex-grow. flex-end, flex-start, space-between etc

align-items: how flex items should be spaced along the cross-axis, if space not fully taken up by flex-grow. flex-end, flex-start, center etc

flex-wrap: by default this is nowrap, but by setting it to wrap, as soon as there is not enough space left (when it’s in a row) for the flex items to go below the flex-basis (the min width if shrink not set), then items will wrap to a new row. width can be used as well, instead of flex-basis on a flex item.

align-content: Spacing of the flex item rows, when flex-wrap was required.

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

What is the purpose of flexbox?

A

Makes it easier to design parts of a layout that are in one direction - row or column

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

Important flex item properties

A

flex: shorthand for flex-grow, flex-shrink and flex-basis. If only a number is used, then the space will be given to the flex items, as ratios, depending on the number assigned to each.

flex-basis: width if direction is row, height if direction is column

flex-grow: Also as a ratio, of how flex items will share the amount of available space, if all the space is not taken up (with flex-basis values)

flex-shrink: Also as ratio, of how much a flex-item will shrink compared to the items siblings.

align-self: overwrites the align-items property for this specific flex item