Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
B
bootstrap
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
bootstrap
Commits
18a40825
Commit
18a40825
authored
Aug 06, 2013
by
Mark Otto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixes #8935: add gutter width param to grid mixins
parent
e1008177
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
60 additions
and
23 deletions
+60
-23
css.html
css.html
+49
-12
less/mixins.less
less/mixins.less
+11
-11
No files found.
css.html
View file @
18a40825
...
@@ -388,26 +388,36 @@ base_url: "../"
...
@@ -388,26 +388,36 @@ base_url: "../"
<p>
Mixins are used in conjunction with the grid variables to generate semantic CSS for individual grid columns.
</p>
<p>
Mixins are used in conjunction with the grid variables to generate semantic CSS for individual grid columns.
</p>
{% highlight css %}
{% highlight css %}
// Creates a wrapper for a series of columns
// Creates a wrapper for a series of columns
.make-row() {
.make-row(@gutter: @grid-gutter-width) {
// Negative margin the row out to align the content of columns
margin-left: (@grid-gutter-width / -2);
margin-right: (@grid-gutter-width / -2);
// Then clear the floated columns
// Then clear the floated columns
.clearfix();
.clearfix();
@media (min-width: @screen-small) {
margin-left: (@gutter / -2);
margin-right: (@gutter / -2);
}
// Negative margin nested rows out to align the content of columns
.row {
margin-left: (@gutter / -2);
margin-right: (@gutter / -2);
}
}
}
// Generate the columns
// Generate the columns
.make-column(@columns) {
.make-column(@columns; @gutter: @grid-gutter-width) {
position: relative;
// Prevent columns from collapsing when empty
min-height: 1px;
// Inner gutter via padding
padding-left: (@gutter / 2);
padding-right: (@gutter / 2);
// Calculate width based on number of columns available
@media (min-width: @grid-float-breakpoint) {
@media (min-width: @grid-float-breakpoint) {
float: left;
float: left;
// Calculate width based on number of columns available
width: percentage((@columns / @grid-columns));
width: percentage(@columns / @grid-columns);
}
}
// Prevent columns from collapsing when empty
min-height: 1px;
// Set inner padding as gutters instead of margin
padding-left: (@grid-gutter-width / 2);
padding-right: (@grid-gutter-width / 2);
}
}
// Generate the column offsets
// Generate the column offsets
...
@@ -416,6 +426,33 @@ base_url: "../"
...
@@ -416,6 +426,33 @@ base_url: "../"
margin-left: percentage((@columns / @grid-columns));
margin-left: percentage((@columns / @grid-columns));
}
}
}
}
.make-column-push(@columns) {
@media (min-width: @grid-float-breakpoint) {
left: percentage((@columns / @grid-columns));
}
}
.make-column-pull(@columns) {
@media (min-width: @grid-float-breakpoint) {
right: percentage((@columns / @grid-columns));
}
}
// Generate the small columns
.make-small-column(@columns; @gutter: @grid-gutter-width) {
position: relative;
float: left;
// Prevent columns from collapsing when empty
min-height: 1px;
// Inner gutter via padding
padding-left: (@gutter / 2);
padding-right: (@gutter / 2);
@max-width: (@grid-float-breakpoint - 1);
// Calculate width based on number of columns available
@media (max-width: @max-width) {
width: percentage((@columns / @grid-columns));
}
}
{% endhighlight %}
{% endhighlight %}
<h4>
Example usage
</h4>
<h4>
Example usage
</h4>
...
...
less/mixins.less
View file @
18a40825
...
@@ -441,30 +441,30 @@
...
@@ -441,30 +441,30 @@
}
}
// Creates a wrapper for a series of columns
// Creates a wrapper for a series of columns
.make-row() {
.make-row(
@gutter: @grid-gutter-width
) {
// Then clear the floated columns
// Then clear the floated columns
.clearfix();
.clearfix();
@media (min-width: @screen-small) {
@media (min-width: @screen-small) {
margin-left: (@g
rid-gutter-width
/ -2);
margin-left: (@g
utter
/ -2);
margin-right: (@g
rid-gutter-width
/ -2);
margin-right: (@g
utter
/ -2);
}
}
// Negative margin nested rows out to align the content of columns
// Negative margin nested rows out to align the content of columns
.row {
.row {
margin-left: (@g
rid-gutter-width
/ -2);
margin-left: (@g
utter
/ -2);
margin-right: (@g
rid-gutter-width
/ -2);
margin-right: (@g
utter
/ -2);
}
}
}
}
// Generate the columns
// Generate the columns
.make-column(@columns) {
.make-column(@columns
; @gutter: @grid-gutter-width
) {
position: relative;
position: relative;
// Prevent columns from collapsing when empty
// Prevent columns from collapsing when empty
min-height: 1px;
min-height: 1px;
// Inner gutter via padding
// Inner gutter via padding
padding-left: (@g
rid-gutter-width
/ 2);
padding-left: (@g
utter
/ 2);
padding-right: (@g
rid-gutter-width
/ 2);
padding-right: (@g
utter
/ 2);
// Calculate width based on number of columns available
// Calculate width based on number of columns available
@media (min-width: @grid-float-breakpoint) {
@media (min-width: @grid-float-breakpoint) {
...
@@ -491,14 +491,14 @@
...
@@ -491,14 +491,14 @@
}
}
// Generate the small columns
// Generate the small columns
.make-small-column(@columns) {
.make-small-column(@columns
; @gutter: @grid-gutter-width
) {
position: relative;
position: relative;
float: left;
float: left;
// Prevent columns from collapsing when empty
// Prevent columns from collapsing when empty
min-height: 1px;
min-height: 1px;
// Inner gutter via padding
// Inner gutter via padding
padding-left: (@g
rid-gutter-width
/ 2);
padding-left: (@g
utter
/ 2);
padding-right: (@g
rid-gutter-width
/ 2);
padding-right: (@g
utter
/ 2);
@max-width: (@grid-float-breakpoint - 1);
@max-width: (@grid-float-breakpoint - 1);
// Calculate width based on number of columns available
// Calculate width based on number of columns available
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment