Layout Flashcards

1
Q

What are the three properties to determine a layout?

A

Float, display, position

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

What type of elements (2) are ALL HTML elements?

A

They are either block or inline block elements

Block:

1) 100% width of container
2) Elements are stacked

Inline:

1) Same width as its content
2) Elements are side by side instead of stacked

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

What is the power of the display property?

A

Use the value of inline or block in display to change the default display behavior of an element

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

What does float do?

A

It aligns the element to iit’s container by left or right. This will change the natural pageflow and stacking layout

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

What is position used for?

A

Can be used to position elements on the page

Three values: Relative, Absolute, Fixed

Note: MUST be used with one offset property: top, right, bottom, or left

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

Give an example of using relative position

A

It is used to position the element from it’s current position.

.box{

position: relatve;
left: 20px;
top: 10px;

}

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

Give an example of using absolute position

A

The parent element must first be set to position relative. The element will be taken out of the natural page flow. So if you had three stacked boxes and made box two absolute, box three would take it’s original place under box 1.

.parent {

position: relative;

}

.box2{

position: absolute;
right: 20px;
bottom: 20px;

}

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

Give an example of fixed position

A

Element doesn’t adhere to it’s parent and instead stays fixed to the viewport even when you scroll the page.

.parent {

position: relative;

}

.box2 {

position: fixed;
right: 20px;
bottom: 20px;

}

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

Give an example of sticky

A

It’s remain in position until a certain condition is adhered, then it’ll act as fixed

.sticky {

position: sticky;

top 10px; /* element becomes fixed once its position from the top is 10px or more */

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