【问题标题】:How to make div resize on window size without losing its float?如何在不丢失浮动的情况下使 div 在窗口大小上调整大小?
【发布时间】:2014-03-16 06:07:20
【问题描述】:

我有一个 cmets 块,其中每个评论基本上由 2 个 div 组成: 头像(浮动:左,固定)和comment_text(相对宽度)。

http://cssdesk.com/YwgA2

我在调整浏览器窗口大小时遇到​​问题。在调整大小时,发生的第一件事 - 右 div 下降。只有当它在第一个 div 下时,它才会开始调整大小。

我希望comment_text div在它进入浮动div之前调整为最小尺寸。

我该怎么做?

【问题讨论】:

  • 在 .comment_text 中修改这些样式声明 remove display give margin-left:110px;
  • for arrow give top in px
  • @XciA 谢谢!这解决了一个问题!
  • 想知道答案是否有帮助..

标签: css html responsive-design css-float


【解决方案1】:

您尚未设置.comment_text 的宽度。设置

width: calc(100% - 110px); // 100px for the avatars width and 10 to compensate margins

您不妨也设置一个min-width

检查这个:http://cssdesk.com/rzkaF

【讨论】:

    猜你喜欢
    • 2018-05-11
    • 2013-12-22
    • 2016-05-22
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-02-07
    相关资源
    最近更新 更多