Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Bootstrap 3 div auto width not 100% of parent div

I want to make a div for showing content in a small box. I want the div to be auto width but it is always going 100% of the parent div, is div maybe not the best way?

<div class="rental-feature">
    <span class="feature-icon door"></span>
    <span class="feature-text">2222222</span>
</div>

Here is a link to an image of what I am trying to do, the content in feature text should control the width. But when I make it as is, the code always goes to 100% of the parent div.

enter image description here

like image 676
user3007115 Avatar asked Jan 11 '23 21:01

user3007115


1 Answers

Set the div to display:inline-block; in the css.

It should then get the width of the content instead of filling out the parent.

like image 177
Rasmus Stougaard Avatar answered Jan 16 '23 18:01

Rasmus Stougaard