Miscellaneous Important Tips and Tricks Flashcards

1
Q

Create a clearfix style

A

.clearfix::after { display: block; content: ‘’; clear: both; }.

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

Enable text to display ellipses when it overflows

A

text-overflow: ellipsis;

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

Prevent text from wrapping:

A

white-space: nowrap (or normal for wrapping)

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

Handle whitespace so that spaces are respected or not

A

Use pre element; alternately, use white-space: pre;

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

Hide text such that it is still accessible to screen readers

A

.accessible-hidden { width: 1px, height: 1px; position: absolute !important; clip: rect(1px, 1px, 1px, 1px); }

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

Create sections of 700px width without wrapper divs (such that background can extend 100% and text only 700px)

A

padding: 1rem calc(50% - 350px); that’s simplified from (100% - 700px)/2 because 100/2 and 700/2.

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

create a rectangle with 16/9 aspect ratio using css alone, no width value.

A

height: 0

padding-top: 56.25%

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