Skip to content

Commit

Permalink
Included position utilities
Browse files Browse the repository at this point in the history
  • Loading branch information
m-spyratos committed Jul 29, 2019
1 parent 8c941b5 commit c4db9d9
Show file tree
Hide file tree
Showing 8 changed files with 84 additions and 3 deletions.
1 change: 1 addition & 0 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ module.exports = function (grunt) {
src: [
'utilities/_display.scss',
'utilities/_spacing.scss',
'utilities/_position.scss',
'utilities/_visibility.scss',
'mixins/_visibility.scss'
],
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ Here's what you get that Bootstrap 4 currently doesn't provide out of the box:
* [Display Utility](https://getbootstrap.com/docs/4.1/utilities/display/)
* [Spacing Utility](https://getbootstrap.com/docs/4.1/utilities/spacing/)
* [Visibility Utility](https://getbootstrap.com/docs/4.1/utilities/visibility/)
* [Position Utility](https://getbootstrap.com/docs/4.1/utilities/position/)

If you don't need any of the above, Bootstrap 4 already includes a grid only version with its
[Bootstrap CSS and JS](https://getbootstrap.com/docs/4.1/getting-started/download/#compiled-css-and-js) bundle.
Expand Down
46 changes: 46 additions & 0 deletions css/grid.css
Original file line number Diff line number Diff line change
Expand Up @@ -4707,6 +4707,52 @@ html {
height: 100vh !important;
}

.position-static {
position: static !important;
}

.position-relative {
position: relative !important;
}

.position-absolute {
position: absolute !important;
}

.position-fixed {
position: fixed !important;
}

.position-sticky {
position: -webkit-sticky !important;
position: sticky !important;
}

.fixed-top {
position: fixed;
top: 0;
right: 0;
left: 0;
z-index: 1030;
}

.fixed-bottom {
position: fixed;
right: 0;
bottom: 0;
left: 0;
z-index: 1030;
}

@supports ((position: -webkit-sticky) or (position: sticky)) {
.sticky-top {
position: -webkit-sticky;
position: sticky;
top: 0;
z-index: 1020;
}
}

.m-0 {
margin: 0 !important;
}
Expand Down
2 changes: 1 addition & 1 deletion css/grid.min.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "bootstrap-4-grid",
"version": "3.0.0",
"version": "3.1.0",
"description": "Bootstrap 4 grid system and layout utilities",
"main": "css/grid.min.css",
"repository": {
Expand Down
1 change: 1 addition & 0 deletions scss/grid.scss
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ $grid-gutter-width: 30px !default;
@import "breakpoints/mixins/breakpoints";
@import "grid/bootstrap-grid";
@import "sizing/utilities/sizing";
@import "layout/utilities/position";
@import "layout/utilities/spacing";
@import "layout/mixins/visibility";
@import "layout/utilities/visibility";
32 changes: 32 additions & 0 deletions scss/layout/utilities/_position.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
// stylelint-disable declaration-no-important

// Common values
@each $position in $positions {
.position-#{$position} { position: $position !important; }
}

// Shorthand

.fixed-top {
position: fixed;
top: 0;
right: 0;
left: 0;
z-index: $zindex-fixed;
}

.fixed-bottom {
position: fixed;
right: 0;
bottom: 0;
left: 0;
z-index: $zindex-fixed;
}

.sticky-top {
@supports (position: sticky) {
position: sticky;
top: 0;
z-index: $zindex-sticky;
}
}

0 comments on commit c4db9d9

Please sign in to comment.