Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Make div within a link display inline with bootstrap 4?

I have a series of links that I want to display inline. For some reason this was working in Bootstrap 3 but since upgrading to Bootstrap 4 I can no longer get the links to display inline. I’ve tried using floats and display:inline or display:inline-block on the various elements but I can’t seem to get it to work. Here is a code pen where I’ve been trying: https://codepen.io/xanabobana/pen/pobRxpx

And my code:

.speciesDiv {
    display: inline;
    margin: 0.3em;
}

.label-success {
    background-color: #5cb85c;
}
.label {
    padding: 0.2em 0.6em 0.3em;
    font-size: 75%;
    font-weight: 700;
    line-height: 1;
    color: #fff;
    text-align: center;
    white-space: nowrap;
    vertical-align: baseline;
    border-radius: 0.25em;
}

.scrolldown-click {
  display:inline;
  float:left;
}
<div class="list-group" id="speciesList">
    <p>Jump to:</p>

        <a class='scrolldown-click' role='button' href='#0-species-div'><div class='label label-sm label-success speciesDiv'>Abies balsamea</div></a>
  
        <a class='scrolldown-click' role='button' href='#58-species-div'><div class='label label-sm label-success speciesDiv'>Acer rubrum</div></a>
  
        <a class='scrolldown-click' role='button' href='#43-species-div'><div class='label label-sm label-success speciesDiv'>Acer saccharum</div></a>

</div>

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

You can use Flexbox to achieve it.

Add following CSS

.list-group {
  display: flex;
  flex-direction: row;
}

CodePen

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading