html - 文本溢出 div - 溢出 : auto not working

标签 html css

如果你去here然后单击缩略图,然后单击其中一个标签,您会看到我的问题。对于文字过多溢出的标签,不放入滚动条。我不能设置固定宽度,因为第一部分(标题)因提交的内容而异。

这是应该在需要时放入卷轴的部分的 css。

#scroll-pane{
left: -3px;
position: relative;
width: 100%;
overflow: auto;
font-family:helvetica;
font-size:11px;
color:#fff;
}

有什么想法吗?我相信这对你们来说是个简单的问题。

皮哈:

(function($) {
    $('#tag_info1').each(function() {
        var container = $(this);
        var total_height = container.height();
        var content_height = parseInt($('span.tag_title', container).outerHeight(true), 10) + parseInt($('span.tag_submission', container).outerHeight(true), 10);
        var p_height = 0;
        p_height+=parseInt($('span.tag_submission_text', container).css('padding-top'), 10);
        p_height+=parseInt($('span.tag_submission_text', container).css('padding-bottom'), 10);        
        p_height+=parseInt($('span.tag_submission_text', container).css('margin-top'), 10);
        p_height+=parseInt($('span.tag_submission_text', container).css('margin-bottom'), 10);  
        p_height+=parseInt($('span.tag_submission_text', container).css('borderTopWidth'), 10);
        p_height+=parseInt($('span.tag_submission_text', container).css('borderBottomWidth'), 10);

        $('span.tag_submission_text', this).height(total_height-content_height-p_height);
    });
})(jQuery);

试图让它与我的一起工作,但无济于事:(

最佳答案

overflow: auto 确实有效。它只是不存在。

您已将 overflow: auto; 添加到段落中。

段落不知道高度是多少。如果将它添加到容器中,它将起作用。

或者给段落一个高度。

我设置了一个 demo其中显示了如何计算剩余高度。能够为您的段落设置正确的高度。

关于html - 文本溢出 div - 溢出 : auto not working,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8547712/

相关文章:

Javascript 代码有时只运行

html - 媒体查询根本不起作用

jquery - 实时显示高度变化

javascript - 将 URL 复制到剪贴板并显示和隐藏消息

html - 在 Bootstrap 3 的容器流体类中嵌套容器类?

当元素在父元素之外时,CSS 空格变成换行符

css - HTML/CSS float 侧边栏,但页面顶部的正常行为

java - 电话号码链接不可点击android

html - 设计具有 3D 效果的 table

Javascript:仅验证 alpha 和空格