Styled text missing spaces in Accordion button #41178
-
Hello, JSFiddle: https://jsfiddle.net/z6vo594y/ I'm using accordion component as per the doc: <div class="accordion" id="accordionExample">
<div class="accordion-item">
<h2 class="accordion-header">
<button class="accordion-button" type="button" data-bs-toggle="collapse" data-bs-target="#collapseOne" aria-expanded="true" aria-controls="collapseOne">
Accordion Item #1 <span class="fw-bold">Bold text.</span> <span class="fst-italic">Italic text.</span>
</button>
</h2>
<div id="collapseOne" class="accordion-collapse collapse show" data-bs-parent="#accordionExample">
<div class="accordion-body">
<strong>This is the first item's accordion body.</strong> It is shown by default, until the collapse plugin adds the appropriate classes that we use to style each element. These classes control the overall appearance, as well as the showing and hiding via CSS transitions. You can modify any of this with custom CSS or overriding our default variables. It's also worth noting that just about any HTML can go within the <code>.accordion-body</code>, though the transition does limit overflow.
</div>
</div>
</div>
</div> But this results in: It seems there are missing spaces between the normal text and styled text. Is this normal behavior? Note this works well with normal button: <button type="button" class="btn btn-primary">Primary <span class="fw-bold">Bold text.</span> <span class="fst-italic">Italic text.</span></button> Thanks! |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
It's due to the flexbox rules on the accordion button. To fix it I'd suggest adding the class Accordion Item #1 <span class="fw-bold mx-1">Bold text.</span> <span class="fst-italic mx-1">Italic text.</span> |
Beta Was this translation helpful? Give feedback.
-
The workaround works! I will use (But still, I think the behavior I noticed is abnormal.) |
Beta Was this translation helpful? Give feedback.
It's due to the flexbox rules on the accordion button. To fix it I'd suggest adding the class
mx-1
to your spans to give a little horizontal margin - works great :-)