21

Is there a way to assign the Bootstrap link style to a non <a> element?

I mean something like this:

<span class="link">Some text</span>

3 Answers 3

24

You can use the classes btn btn-link. These are Bootstrap link styles that usually are found on anchor tags or button tags but if you use it on any other text it will use those styles on your text. It may not yield the exact same results so your CSS may need to be tweaked.

1
  • Can you expand a little on exactly what this does and how it might answer the OP?
    – Ro Yo Mi
    May 4, 2016 at 1:44
3

No. Non exists CSS class with link styles. If you open source code of Bootstrap you can find definition link styles for a tag.

bootstrap/scss/_reboot.scss

//
// Links
//

a {
   color: $link-color;
   text-decoration: $link-decoration;
   background-color: transparent; // Remove the gray background on active links in IE 10.
   -webkit-text-decoration-skip: objects; // Remove gaps in links underline in iOS 8+ and Safari 8+.

   @include hover {
      color: $link-hover-color;
      text-decoration: $link-hover-decoration;
   }
}
-1

The correct answer, with bootstrap 4+ is to add these 2 classes on your a element

text-reset : Reset a text or link’s color with .text-reset, so that it inherits the color from its parent.

text-decoration-none : Remove a text decoration with a .text-decoration-none class.

For more information see the official documentation : https://getbootstrap.com/docs/4.2/utilities/text/

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.