Responsive Border Utilities
See original GitHub issueIt would be great to be able to do something like this:
<div class="border-top border-lg-top-0 border-lg-left">...</div>
So in this example, you’ll have:
- a 1px top border from xs to md
- a 1px left border from lg to xl (the top border get’s removed)
Here’s what the SASS might look like:
`@each $breakpoint in map-keys($grid-breakpoints) { @include media-breakpoint-up($breakpoint) { $infix: breakpoint-infix($breakpoint, $grid-breakpoints);
.border#{$infix}-top-0{ border-top: 0 !important;}
.border#{$infix}-right-0{ border-right: 0 !important;}
.border#{$infix}-bottom-0{ border-bottom: 0 !important;}
.border#{$infix}-left-0{ border-left: 0 !important;}
.border#{$infix}-top{ border-top: 1px solid $gray-200 !important;}
.border#{$infix}-right{ border-right: 1px solid $gray-200 !important;}
.border#{$infix}-bottom{ border-bottom: 1px solid $gray-200 !important;}
.border#{$infix}-left{ border-left: 1px solid $gray-200 !important;}
.border#{$infix}-x{ border-left: 1px solid $gray-200 !important; border-right: 1px solid $gray-200 !important;}
.border#{$infix}-y{ border-top: 1px solid $gray-200 !important; border-bottom: 1px solid $gray-200 !important;}
}
}`
Issue Analytics
- State:
- Created 6 years ago
- Reactions:37
- Comments:18 (4 by maintainers)
Top Results From Across the Web
Borders - Bootstrap
Great for images, buttons, or any other element. Border. Use border utilities to add or remove an element's borders. Choose from all borders...
Read more >Border | U.S. Web Design System (USWDS)
responsive ; active; hover; focus; visited. Note: The border utilities apply a solid border of specified width. If no width is specified, the...
Read more >Applying borders on elements depending on device size with ...
I'm using bootstrap to create a mobile first responsive layout and have various rows and columns set up that I ...
Read more >Bootstrap Borders - examples & tutorial
Use border utilities to quickly style the border and border-radius of an element. Great for images, buttons, or any other element.
Read more >Borders | Primer CSS
You can adjust border widths on all sides or each side individually with responsive border utilities: border-(sm|md|lg|xl) adds borders on all ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

No plans to make these responsive.
Since I had the same issue today, here’s an updated version of @LarryAzevedo’s proposal that uses the proper BS4 variables: