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.

Button links with text state colors

See original GitHub issue

Curious about community need / interest in this feature. I often use btn-link buttons and want to be able to color the buttons per the text state colors provided by Bootstrap. I have found it intuitive to try class="btn-link text-danger" for a delete link button, to no avail.

I now accomplish this by adding the below to my Bootstrap override LESS file. I feel something like this should ship with Bootstrap. What do the maintainers and the community think?

.btn-link {
    &.text-success {
        .text-emphasis-variant(@state-success-text);
    }
    &.text-info {
        .text-emphasis-variant(@state-info-text);
    }
    &.text-warning {
        .text-emphasis-variant(@state-warning-text);
    }
    &.text-danger {
        .text-emphasis-variant(@state-danger-text);
    }
    &.text-muted {
        .text-emphasis-variant(@text-muted);
    }
}

Issue Analytics

  • State:closed
  • Created 9 years ago
  • Reactions:4
  • Comments:6

github_iconTop GitHub Comments

10reactions
cvrebertcommented, Feb 26, 2015

As mentioned in the docs, just use a wrapper span: <button class="btn btn-link"><span class="text-danger">Your text</span></button>

1reaction
roberkulescommented, Aug 28, 2018

just had the same issue, updated example for bootstrap 4 / sass:

.btn-link {
  @each $name, $color in (success: $success, info: $info, warning: $warning, danger: $danger) {
    &.text-#{$name} {
      @include hover-focus {
        color: darken($color, 10%) !important;
      }
    }
  }
}
Read more comments on GitHub >

github_iconTop Results From Across the Web

Customize Css button links color - Stack Overflow
I'm creating clickable CSS buttons for my website and want a green button with a white text. But my default link color (blue)...
Read more >
HTML Link Colors - W3Schools
An unvisited link is underlined and blue; A visited link is underlined and purple; An active link is underlined and red. You can...
Read more >
How To Use Links and Buttons with State Pseudo-Classes in ...
Start by opening up styles.css in your text editor. Create a new class selector called .button . The styles here will redefine many...
Read more >
How to change the color of links on a web page
HTML body tag example ; TEXT = The color of text. ; LINK = The color of links. ; VLINK = Visited link...
Read more >
How to Change Link Colors with CSS - W3docs
Add the style attribute directly to the hyperlink code and specify the color property through the style attribute, then give a color value...
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