html - Bootstrap 3 div 自动宽度不是父 div 的 100%

标签 html css twitter-bootstrap twitter-bootstrap-3

我想制作一个 div 来在一个小盒子里显示内容。我希望 div 为自动宽度,但它总是占父 div 的 100%,div 可能不是最好的方法吗?

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

这是我正在尝试做的图像的链接,功能文本中的内容应控制宽度。但是当我按原样制作时,代码总是转到父 div 的 100%。

enter image description here

最佳答案

将div设置为display:inline-block;在CSS中。

然后它应该获取内容的宽度而不是填充父元素。

关于html - Bootstrap 3 div 自动宽度不是父 div 的 100%,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20062201/

相关文章:

html - 自定义复选框在 IE 7 和 IE 8 中不起作用

html - 如何去除 Bootstrap 3 中出现的空白?

html - 自定义选择输入 Angular 4

html - EM 中的宽度不符合我的预期

javascript - 如何让父事件在点击子元素时不触发,但不阻止子元素事件

html - 如何使用 CSS [Twitter Bootstrap] 创建类似 Pinterest 的网格

css - bootstrap flex 行高匹配

javascript - 为大型项目的新版本从 Flash 切换到 HTML5?

html - 中心 Bootstrap 下拉菜单

javascript - 更改 480 宽度 Javascript 按钮的 URL