html - 将文本保持在同一行

标签 html css twitter-bootstrap responsive-design

我正在使用 Bootstrap 编写网页。我怎样才能使文本在一行上对齐?它在大屏幕上看起来不错,但对于移动屏幕,它分成三部分。

我知道我已经固定了文本的字体大小,但最初我希望字体大小大于实际大小。有解决办法吗?对于移动屏幕,我如何才能使文本对齐到单行(如在 PC 上的外观)?

以下是text-grid:

<div class='row first-layer'>
  <div class='col-lg-1 col-md-1 col-sm-1 col-xs-1'>  </div>      
  <div class='col-lg-10 col-md-10 col-sm-10 col-xs-10 text-center page-header'><b>Title of Web Page</b></div>
  <div class='col-lg-1 col-md-1 col-sm-1 col-xs-1'>  </div>
</div>

.page-header {
  font-family: Calli;
  font-size: 60px;
  color: #996699;
 }

在 PC 上显示:

enter image description here

在手机上显示:

enter image description here

最佳答案

使用white-space: nowrap;,但这会导致文本溢出。
如果以 vw 单位设置字体大小会更好:

.page-header {
  font-family: Calli;
  font-size: 10vw;
  color: #996699;
 }
<div class='row first-layer'>
  <div class='col-lg-1 col-md-1 col-sm-1 col-xs-1'>  </div>      
  <div class='col-lg-10 col-md-10 col-sm-10 col-xs-10 text-center page-header'><b>Title of Web Page</b></div>
  <div class='col-lg-1 col-md-1 col-sm-1 col-xs-1'>  </div>
</div>

关于html - 将文本保持在同一行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28137382/

相关文章:

css - 停止跨越 2 行的导航菜单

javascript - 从一个样式表淡出到另一个

html - 是什么导致我的 div 容器中有这么多空间?

html - 在 div 中垂直居中 ul

JavaScript/jQuery 多级 Accordion 不会关闭复选框

javascript - Jquery 下拉菜单

jquery - Bootstrap 多选不工作

angularjs - bootstrap-multiselect 下拉菜单 - 将焦点集中在搜索上并实现 typeahead 功能

javascript - 网站中的随机字母 C?

html - 边距不适用于 Safari(元素位于页面底部)