【问题标题】:How to increase the height of a div and warp the content in it vertically如何增加 div 的高度并垂直扭曲其中的内容
【发布时间】:2013-03-05 05:05:05
【问题描述】:

通常,div 容器的高度会垂直向下增加,其中的内容也会增加。有没有办法扭转这种情况,即通过让内容从底部开始向上翘曲来向上增加高度?

【问题讨论】:

标签: html css


【解决方案1】:

您可以通过定位容器来实现这一点。

HTML

<div>asdfasdfadsf safsadfsd asdfsaasdfasd asdfasd asdf</div>

CSS

div{
     position:absolute;
     bottom:15px;
}

Working fiddle

【讨论】:

    【解决方案2】:

    您需要为此使用 Javascript。 Here's an example 使用 JQuery。

    根据您所期望的行为,您可能需要对其进行更改。请提供有关用户尝试滚动时您期望发生的情况的更多信息。此外,如何/何时/在何处添加或删除内容?

    【讨论】:

      【解决方案3】:

      默认情况下 div 从顶部开始 并通过其内容向下增加其高度 所以你必须将它的位置设置为底部然后它不会向下增加它的大小

      div {
          position:absolute;
          bottom:30px;
      
      
      }
      

      这是我为你制作的fiddle

      【讨论】:

        猜你喜欢
        • 2014-02-09
        • 2016-02-24
        • 1970-01-01
        • 2018-01-20
        • 1970-01-01
        • 2010-09-08
        • 2011-07-22
        • 2011-03-31
        • 1970-01-01
        相关资源
        最近更新 更多