8

我有一个 div,文本不会留在其中,我不知道为什么,在我希望有人能帮助我之前,我从来没有遇到过这个问题,这是我的代码:

HTML:

#toronto-content {
  position: relative;
  z-index: 98;
  height: 100%;
  width: 700px;
  background-color: #0A0A0A;
  color: #FFF;
}
<div id="toronto-content">

  Interactively pursue long-term high-impact vortals and distributed systems. Competently streamline team driven testing procedures without leading-edge intellectual capital. Energistically engage market-driven catalysts for change via client-centered technologies.
  Compellingly architect long-term high-impact intellectual capital and resource-leveling interfaces. Phosfluorescently initiate market positioning supply chains with stand-alone processes. Collaboratively generate leading-edge services for synergistic
  e-markets. Conveniently syndicate bleeding-edge resources whereas equity invested scenarios. Collaboratively parallel task backward-compatible deliverables and business relationships. Assertively implement turnkey niche markets for technically sound
  human capital. Collaboratively integrate pandemic niche markets with corporate action items. Quickly utilize timely paradigms after best-of-breed infomediaries. Appropriately drive future-proof initiatives via standards compliant opportunities. Uniquely
  coordinate 24/365 mindshare vis-a-vis top-line synergy. Phosfluorescently benchmark one-to-one mindshare with high-payoff best practices. Distinctively supply principle-centered relationships whereas revolutionary relationships.

</div>

如果你想在这里查看完整的网站:http: //lasociete.ca/new/

4

3 回答 3

16

这将解决您的问题:

#toronto-content {
  white-space: normal;
}

但我会考虑将您的文本放入<p>or<span>标记中。

于 2013-10-17T19:56:27.207 回答
4

那是因为文本量大于div.
我建议添加overflow:overlay到您的样式中,这将在内容旁边创建一个垂直滚动条。

如果添加overflow:scroll它,即使不需要它也会创建一个水平滚动条。

如果这不是您想要的,您应该在内容过多时添加页面(称为“分页”)或使用 Javascript 或 jQuery 制作自定义垂直滚动条。

于 2013-10-17T20:11:14.910 回答
3

添加这个

#toronto-content {
  white-space: normal;
  overflow: hidden;
}
于 2017-12-17T12:30:53.067 回答