Home > Software design >  Bootstrap Group Button and text but with space between them
Bootstrap Group Button and text but with space between them

Time:09-28

Hello I want the text and button I have to be on a single line instead of underneath each other. First I did this with

<div  role="group" aria-label="Basic example"><p>Document2.pdf</p><button type="button" >Download</button></div><br>

But this put the button and the text right next to each other with no spacing. So instead of btn-group I used btn-toolbar but this put the items underneath each other.

<div  role="group" aria-label="Basic example"><p>Document1.pdf</p><br><button type="button" >Download</button></div><br>

I tried adding flex-wrap: nowrap but this didn't work. Does anyone know how to fix this problem and properly align them?

CodePudding user response:

Why not adding margin-right?

See the snippet below.

p {
  margin-right: 16px;
}
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC" crossorigin="anonymous">
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js" integrity="sha384-MrcW6ZMFYlzcLA8Nl NtUVF0sA7MsXsP1UyJoMp4YLEuNSfAP JcXn/tWtIaxVXM" crossorigin="anonymous"></script>

<div  role="group" aria-label="Basic example">
  <p>Document2.pdf</p><button type="button" >Download</button>
</div>

  • Related