question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Responsive Border Utilities

See original GitHub issue

It 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:

  1. a 1px top border from xs to md
  2. 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:closed
  • Created 6 years ago
  • Reactions:37
  • Comments:18 (4 by maintainers)

github_iconTop GitHub Comments

132reactions
mdocommented, Sep 9, 2017

No plans to make these responsive.

97reactions
spaceemotioncommented, Apr 29, 2018

Since I had the same issue today, here’s an updated version of @LarryAzevedo’s proposal that uses the proper BS4 variables:

@each $breakpoint in map-keys($grid-breakpoints) {
  @include media-breakpoint-up($breakpoint) {
    $infix: breakpoint-infix($breakpoint, $grid-breakpoints);

    .border#{$infix}-top {      border-top: $border-width solid $border-color !important; }
    .border#{$infix}-right {    border-right: $border-width solid $border-color !important; }
    .border#{$infix}-bottom {   border-bottom: $border-width solid $border-color !important; }
    .border#{$infix}-left {     border-left: $border-width solid $border-color !important; }

    .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}-x {
      border-left: $border-width solid $border-color !important;
      border-right: $border-width solid $border-color !important;
    }

    .border#{$infix}-y {
      border-top: $border-width solid $border-color !important;
      border-bottom: $border-width solid $border-color !important;
    }
  }
}
Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found