CSS Shorthand Flashcards

(15 cards)

1
Q

What is the CSS shorthand property for setting all margins?

A
margin: top right bottom left;

You can also use 1 to 4 values:

margin: 10px;              /* All sides */
margin: 10px 20px;         /* Top & bottom | Left & right */
margin: 10px 20px 30px;    /* Top | Left & right | Bottom */
margin: 10px 20px 30px 40px; /* Top | Right | Bottom | Left */
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

How do you use the shorthand padding property?

A
padding: 10px;              /* All sides */
padding: 10px 20px;         /* Top & bottom | Left & right */
padding: 10px 20px 30px;    /* Top | Left & right | Bottom */
padding: 10px 20px 30px 40px; /* Top | Right | Bottom | Left */
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

How do you use the CSS shorthand for setting a border?

A
border: 1px solid black;

This sets:

Border width: 1px

Border style: solid

Border color: black

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

How do you write a complete font shorthand declaration?

A
font: italic small-caps bold 16px/1.5 "Open Sans", sans-serif;

Order:

font-style

font-variant

font-weight

font-size

/line-height

font-family

At minimum, font-size and font-family are required.

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

What is the CSS shorthand for setting a background?

A
background: #fff url('bg.jpg') no-repeat center center / cover;

Sets:

Background color

Image

Repeat

Position

Size
You can also control background-attachment and background-origin.

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

How do you use the shorthand list-style?

A

Sets:

list-style-type: square

list-style-position: inside

You can also add an image:
~~~

list-style: square inside url(‘bullet.png’);
~~~

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

What does the flex shorthand represent?

A
flex: 1 1 auto;

Sets:

flex-grow

flex-shrink

flex-basis

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

How do you use the shorthand for animation?

A
animation: slide-in 2s ease-in-out 0.5s infinite alternate;

Sets:
Name
Duration
Timing-function
Delay
Iteration count
Direction
Fill-mode (optional)
Play state (optional)

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

How do you write a transition shorthand?

A
transition: background-color 0.3s ease-in-out 0.2s;

Sets:
Property
Duration
Timing-function
Delay

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

How do you write the outline shorthand?

A

outline: 2px dashed red;

Sets: width, style, color

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

How do you write a shorthand for multi-columns?

A
columns: 200px 3;

Sets: column width, column count

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

What does the grid shorthand do?

A
grid: auto-flow / 1fr 1fr 1fr;

Sets:
grid-template-rows
grid-template-columns
grid-auto-flow

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

How do you set the shorthand for grid-area?

A
grid-area: 1 / 2 / 3 / 4

Combines: grid-row-start, grid-column-start, grid-row-end, grid-column-end.

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

Set the shorthand for text-decoration.

A
text-decoration: underline red wavy;

Combines: text-decoration-line, text-decoration-color, text-decoration-style, text-decoration-thickness.

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

Set the shorthand for filter.

A
filter: grayscale(50%) blur(2px);

Combines: various filter functions like blur(), brightness(), contrast(), drop-shadow(), grayscale(), hue-rotate(), invert(), opacity(), sepia(), saturate().

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