【问题标题】:Text not fitting the width of container文本不适合容器的宽度
【发布时间】:2016-01-21 21:04:06
【问题描述】:

这看起来将是一个简单的问题,但我无法理解它。如您所见here,文本使用容器的宽度,但是当我更改容器的宽度时,文本适合但看起来像this,并将侧边栏向下推。

   .container {
        width:1130px;
        margin:0 auto;
    }
    .container.sp_sidebar {
        overflow:hidden;
    }
    #main {
        width:100%;
    } 
    .container.sp_sidebar #main {
        width:770px;
        margin-right:30px;
        float:left;
    }
    #sidebar {
        width:300px;
        float:right;
    }

我尝试将容器向左浮动,并删除边距 0。

【问题讨论】:

    标签: css sizetofit


    【解决方案1】:

    您需要一些空格来换行(如在普通文本中)。下次尝试使用一些Lorem Ipsum 文本作为占位符。

    【讨论】:

      【解决方案2】:

      试着在那个可怕的词里加一个空格。

      或将word-break: break-all; (docs) 添加到您的 CSS。

      【讨论】:

      • 虽然改进了,w3schools 仍然是一个糟糕的参考。 MDN 更好。
      猜你喜欢
      • 2023-03-08
      • 1970-01-01
      • 2017-08-08
      • 2022-12-01
      • 2014-09-18
      • 2018-02-28
      • 2022-11-06
      • 1970-01-01
      • 2017-12-03
      相关资源
      最近更新 更多