html - Bootstrap 如何让文本无响应但在 div 内?

标签 html css twitter-bootstrap

在移动设备中文本是这样的:

enter image description here

但我需要它保持这样:

![enter image description here

我使用的代码:

<div class="container-fluid">
    <div class="row" style="background-color:#071885;">
        <div class="col-md-12 text-center">     
            <h1 style="color: #000;font-weight: bold;background: gold;font-size: 24px; padding: 5px;">
            LONG TITLE LONG TITLE LONG TITLE LONG TITLE LONG TITLE
            </h1>
         </div>
    </div>
    </div>

我已经尝试过 no-wrap 但没有用。

更新:

@库库兹

enter image description here

最佳答案

你可以为此使用 flexbox:

  1. 在行上设置 display: inline-flex 并利用 内联元素将扩展到其内容 的事实。

  2. 现在您可以使用 text-nowrap 类或 white-space: nowrap 来获得您需要的效果 - 请参见下面的演示:

.row {
  display: inline-flex; /* ensures the text stays inside */
  white-space: nowrap;
  min-width: 100vw; /* sets 100% width in desktop */
}
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet">

<div class="container-fluid">
  <div class="row" style="background-color:#071885;">
    <div class="col-md-12 text-center">
      <h1 style="color: #000;font-weight: bold;background: gold;font-size: 24px; padding: 5px;">
        LONG TITLE LONG TITLE LONG TITLE LONG TITLE LONG TITLE
      </h1>
    </div>
  </div>
</div>

关于html - Bootstrap 如何让文本无响应但在 div 内?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55068410/

相关文章:

html - 推特 Bootstrap 下拉菜单不起作用

javascript - AngularJs,Bootstrap Modal 表单无法正确查看

javascript - 如何将 CSS 应用于输入标签值

javascript - jQuery Javascript 集团年复一年

css - Bootstrap :where does this white line come from?

html - 同一行标题元素内垂直居中的子元素

css - Bootstrap 弹出窗口动态大小

python - 如何在 Django 中使用 Bootstrap 主题?

php - 可编辑的分区而不是 Textarea。输入没有被提交! PHP

javascript - 本地 Bootstrap nav-tab 工作,但不能从 github 页面远程