Flexible grids Flashcards

1
Q

Before RWD, what was a dominant approach to website structure?

A

Thinking in fixed proportions. Elements had a certain size and did not adjust if the viewport changed?

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

What do we mean by viewport?

A

The size of browser window (generally measured in pixels)

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

How would we mark up the body element to center it on the page and set its width to 960 pixels?

A

We’ll write a CSS rule

body {
width: 960px;
margin: 0 auto;
}

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

Is there anything wrong with setting type in pixels?

A

No.

What it does mean is type is set at a size and cannot be adjusted by the user.

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

What’s the formula for calculating proportions

A

target / context = result

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

So taking formula how would we translate a 24pt headline into a relative value?

A

Take the default text size for the browser (probably 16px)

take the value of the headline and divide it by 16

24 / 16 = 1.5

We then assign 1.5em as the text size for our headline.

We use ems as these are proportional unit that will resize with a different sized viewport.

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

Say we have the following

<h1>Get more spuds<a>click here!</a></h1>

Assume a default font-size of 16px.

Say we know we want our h1 to be 24px and our link to be 11px. If we wanted to express this as ems what.

Why is that?

A

The context chnages. We talking about a link inside a header tag. Not just a link by itself.

11 / 24 = 0.45833333333

so a {
font-size: 0.4583333333em;
}

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

You’ll sometimes need to decide how wide the body of a page will be as a percentage? Say we have body tha’s 960px wide. How do we decide how wide that should be in %?

A

Ethan recommends testing out options and then. There’s not really a set recommendation.

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

When calculating width of elements and expressing in proportional terms what units should we use?

A

Use % for size of block level elements (e.g. div, html5 structural elements)

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

What would be the problem with fixed margins and padding in a flexible layout?

A

At different viewport sizes, the padding and margins won’t adjust breaking our layout.

With box / block elements we’ll specify the measurement in % using the target/conext=result formula.

The context is always the elements containing element.

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

Can we have negative proportional margins and padding?

A

Yes, You sure can!

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