Skip to content
GitLab
    • Explore Projects Groups Snippets
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • B bootstrap
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 263
    • Issues 263
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 114
    • Merge requests 114
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Bootstrap
  • bootstrap
  • Merge requests
  • !24915
An error occurred while fetching the assigned milestone of the selected merge_request.

Add order-last grid class

  • Review changes

  • Download
  • Email patches
  • Plain diff
Merged Administrator requested to merge github/fork/cahbb/order-last-class into v4-dev 7 years ago
  • Overview 0
  • Commits 3
  • Pipelines 0
  • Changes 2

Created by: cahbb

This PR adds a new .order-last grid class.

It does the exact opposite thing of .order-first. It reorders the target element to be the last using order: $columns + 1;

<div class="container">
  <div class="row">
    <div class="col order-sm-last">
      First by default, but last on sm
    </div>
    <div class="col">
      Second by default, and still second on sm
    </div>
    <div class="col order-sm-first">
      Last by default, but first on sm
    </div>
  </div>
</div>

This gives the user a more intuitive way of understanding how the columns are ordered. Saying "I want this to be the last child on sm" and not begin to figure out how many columns you have in your grid and so on. The child is going to be what you say - the last child.

As it is now you would use the class .order-sm-12 instead of .order-sm-last in the above example.

:rocket: :muscle:

Compare
  • v4-dev (base)

and
  • latest version
    542ba9f9
    3 commits, 2 years ago

2 files
+ 7
- 9

    Preferences

    File browser
    Compare changes
docs/4.‎0/layout‎
gri‎d.md‎ +3 -3
scss/‎mixins‎
_grid-fram‎ework.scss‎ +4 -6
docs/4.0/layout/grid.md
+ 3
- 3
  • View file @ 542ba9f9

  • Edit in single-file editor

  • Open in Web IDE


@@ -534,14 +534,14 @@ Use `.order-` classes for controlling the **visual order** of your content. Thes
{% endexample %}
</div>
There's also a responsive `.order-first` class that quickly changes the order of one element by applying `order: -1`. This class can also be intermixed with the numbered `.order-*` classes as needed.
There are also responsive `.order-first` and `.order-last` classes that change the `order` of an element by applying `order: -1` and `order: 13` (`order: $columns + 1`), respectively. These classes can also be intermixed with the numbered `.order-*` classes as needed.
<div class="bd-example-row">
{% example html %}
<div class="container">
<div class="row">
<div class="col">
First, but unordered
<div class="col order-last">
First, but last
</div>
<div class="col">
Second, but unordered
scss/mixins/_grid-framework.scss
+ 4
- 6
  • View file @ 542ba9f9

  • Edit in single-file editor

  • Open in Web IDE


@@ -46,14 +46,12 @@
}
}
.order#{$infix}-first {
order: -1;
}
.order#{$infix}-first { order: -1; }
.order#{$infix}-last { order: $columns + 1; }
@for $i from 0 through $columns {
.order#{$infix}-#{$i} {
order: $i;
}
.order#{$infix}-#{$i} { order: $i; }
}
// `$columns - 1` because offsetting by the width of an entire row isn't possible
0 Assignees
None
Assign to
0 Reviewers
None
Request review from
Labels
0
None
0
None
    Assign labels
  • Manage project labels

Milestone
No milestone
None
None
Time tracking
No estimate or time spent
Lock merge request
Unlocked
2
2 participants
Nikita Lutsenko
Administrator
Reference:
Source branch: github/fork/cahbb/order-last-class

Menu

Explore Projects Groups Snippets