Output text from div overflow: auto start

if you go here and click on the thumbnail, and then on one of the tags you will see my problem. For tags that have too much text and overflow, it does not put a scrollbar. I cannot set a fixed width, because the first part, the name, varies from one view to another.

Here's the css for the part that was supposed to fit in the scroll when necessary.

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

Any ideas? I am sure this is a simple question for you guys.

PeeHaa:

 (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); 

I tried to get it to work with mine, but to no avail :(

+4
source share
3 answers

overflow: auto works. He is simply not there.

You have added overflow: auto; to the paragraph.

The paragraph does not know what height is. If you add it to the container, it will work.

Or indicate the height of the paragraph.

I installed a demo that shows how to calculate the remaining height. To be able to set the correct height in your paragraph.

+2
source

I have no problem with Firefox. But when you use overflow: auto; You should use it in a container like div.

EDIT: Ok, I understand your problem. You are currently using height: 180px; in the container. If you try something like min-height: 100px; and overflow: auto; in a text container, you can fix the size of the text container.

This way your text container will have the same height, but the container expands if the title is larger.

I do not know if this is clear, but if you want, I can try to explain.

+1
source

I had a similar problem with a div with height , as well as with the specified max-height - it just wouldn't put a scrollbar even if overflow: auto was specified. It worked after I specified min-height in addition to the values ​​of height and max-height .

0
source

Source: https://habr.com/ru/post/1386860/


All Articles