21

I'm wondering if I can make the content in my tab panel scrollable. I have tried a couple things but I don't get it sorted.

<div class="container">
<div class="row">
    <div class="panel panel-primary">
        <div class="panel-heading">
            <h3 class="panel-title">Title</h3>
            <span class="pull-right">
                <ul class="nav panel-tabs">
                    <li class="active"><a href="#tab1" data-toggle="tab">Tab 1</a></li>
                </ul>
            </span>
        </div>            
        <div class="panel-body">
            <div class="tab-content">
                <div class="tab-pane active" id="test">
                    CONTENT
                </div>
            </div>
        </div>
    </div>
</div>

Fiddle: http://jsfiddle.net/f3p35v76/

halfer
  • 19,824
  • 17
  • 99
  • 186
user3425765
  • 291
  • 1
  • 4
  • 12

1 Answers1

34

Are you looking for the content to scroll within the pane?

Fiddle: http://jsfiddle.net/uxsr66hp/1/

.tab-pane{
  height:300px;
  overflow-y:scroll;
  width:100%;
}
M. Kobus
  • 358
  • 3
  • 6
  • 1
    This is what I'm looking for, but the content should use the full width of the pane. (http://puu.sh/aS5Ce/5d982eb3f7.png) – user3425765 Aug 14 '14 at 12:30
  • 1
    I've updated the answer, what you need to add is 'width:100%;', and then the content will take on the full width of the pane. – M. Kobus Aug 14 '14 at 13:00
  • 1
    That works indeed, where should I set the max height of the pane? It should start showing a scrollbar as soon as the pane has more text than fits on the screen. Settings the height to 100% doesn't work. – user3425765 Aug 14 '14 at 13:21
  • 2
    I believe for that, you will want to use javascript and set it to the height of the screen. – M. Kobus Aug 18 '14 at 23:02
  • 2
    Is there a way to avoid hardcoding the height? – Yetti99 Dec 08 '22 at 15:48