What values I should set in twitter bootstrap for

2019-04-29 22:34发布

问题:

I'm using twitter bootstrap with less cloned from github. I want to set grid width variables because I need a 960px fixed layout. Default values for 940px width are:

@gridColumns:             12;
@gridColumnWidth:         60px;
@gridGutterWidth:         20px;

What values I should set for a fixed 960px layout?

I tried with this, but result was 950px:

@gridColumns:             12;
@gridColumnWidth:         70px;
@gridGutterWidth:         10px;

回答1:

Solve the equation

You need to find a solution(s) for the equasion. One of them is:

@gridColumns:             12;
@gridColumnWidth:         69px;
@gridGutterWidth:         12px;

another one:

@gridColumns:             12;
@gridColumnWidth:         58px;
@gridGutterWidth:         24px;

But use default

Bootstrap was designed for 960px width, it just doesn't specify additional margin/padding on the sides:

| ------------------------------ 960px width ---------------------------------- |
10px left margin | ------------- 940px container ------------ | 10px right margin

So I suggest you to use the default values, if you are targeting 960px.



回答2:

You could always make a 960px container and use fluid.