Skip to content
This repository has been archived by the owner on Nov 9, 2017. It is now read-only.

formula for calculating margin? #10

Open
ghost opened this issue Oct 4, 2011 · 3 comments
Open

formula for calculating margin? #10

ghost opened this issue Oct 4, 2011 · 3 comments

Comments

@ghost
Copy link

ghost commented Oct 4, 2011

on the previous responsive site I did, I set a max-width for each media query, then I used a spreadsheet to calculate percentage values for the widths and margins.
For example max-width : 748px
then if I want a width of 2 columns, I'd do( 2 x column width + 1x gutter width) / max-width
how did you get to the values that yo uuse for example in this declaration:
header, #twoway {
margin: 0 27.77777777777778%;
}

thanks
Paul

@paulburgess
Copy link

Yes, this part is confusing me a tad... any help on how you calculate that margin would be great!

I understand the target / context formula but can't see how it applies here.

@torkiljohnsen
Copy link

The calculations can be seen in the LESS and SASS stylesheet variants. I /think/ Joni uses LESS in his work, and that CSS files in this project are compiled LESS files. LESS and SASS are great tools, because they allow you to use all kinds of simplifying helpers in CSS, like functions, variables, mixins and more :)

Regarding how he ends up with the value 27.7777777778%:

If you check out GGS.less, you'll see that 1 column width is calculated as 100%/18 (≈ 5.55555556%)

Then, in the 87em media query, this is added:

header, #twoway {
    margin: 0 @column*5;
}

5.55555556% * 5 ≈ 27.7777778%

@paulburgess
Copy link

Ah yes indeed, once I got into the SASS file it made more sense. Your comment helps too - thanks very much.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants