简体   繁体   中英

How to replicate bootstrap grouped buttons without them being links?

I am trying to take the Bootstrap justified grouped buttons style and create divs that will appear like grouped buttons will be just result in non-link divs. I am using it as a "steps" representation, so button one would be highlighted with text symbolizing that we're on step 1, or button two would highlight when you're on step 2. Please see my attached image here for an example. 引导对齐按钮

The buttons I screenshotted work wonderfully as stage indicators, but I don't want users to be confused and think they should be linking to something. I've tried replacing the button input with spans as follows:

      <div class="btn-group btn-group-justified" role="group">
            <div class="btn-group" role="group">
                <span class="btn btn-default">Q&amp;A</span>
            </div>
            <div class="btn-group" role="group">
                <span class="btn btn-info">Proposal Submissions</span>
            </div>
            <div class="btn-group" role="group">
                <span class="btn btn-default">Best &amp; Final Offers</span>
            </div>
            <div class="btn-group" role="group">
                <span class="btn btn-default">Final Selection</span>
            </div>
        </div>

I don't know if this is even the way I should be going about this, or if there's a standard way to do this with divs. I also tried using divs with the btn classes instead of buttons or spans, same result, it still becomes a link. I am happy to keep using the button classes so long as I can remove the link effect when a cursor is hovered over it.

Thanks for your help.

I would suggest you to see if bootstrap has a component like breadcrumb , because that makes more sense for your use case. But if you want to hack something quickly, you can override btn classes. You could give the parent a class like c-steps and then override the styles for the btn groups:

html

<div class="btn-group btn-group-justified c-steps" role="group">...

css

.c-steps .btn-group,
.c-steps .btn.btn {
  text-decoration: none;
  /* other override styles */
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM