How To Make Bootstrap Panel Body With Fixed Height
I am using bootstrap's panel to display text and image, but as the text grows, the body of the panel also increases. I want to know how to create the body with fixed height, e.g. 1
Solution 1:
You can use max-height
in an inline style
attribute, as below:
<divclass="panel panel-primary"><divclass="panel-heading">jhdsahfjhdfhs</div><divclass="panel-body"style="max-height: 10;">fdoinfds sdofjohisdfj</div></div>
To use scrolling with content that overflows a given max-height
, you can alternatively try the following:
<divclass="panel panel-primary"><divclass="panel-heading">jhdsahfjhdfhs</div><divclass="panel-body"style="max-height: 10;overflow-y: scroll;">fdoinfds sdofjohisdfj</div></div>
To restrict the height to a fixed value you can use something like this.
<divclass="panel panel-primary"><divclass="panel-heading">jhdsahfjhdfhs</div><divclass="panel-body"style="min-height: 10; max-height: 10;">fdoinfds sdofjohisdfj</div></div>
Specify the same value for both max-height
and min-height
(either in pixels or in points – as long as it’s consistent).
You can also put the same styles in css class in a stylesheet (or a style
tag as shown below) and then include the same in your tag. See below:
Style Code:
.fixed-panel {
min-height: 10;
max-height: 10;
overflow-y: scroll;
}
Apply Style :
<divclass="panel panel-primary"><divclass="panel-heading">jhdsahfjhdfhs</div><divclass="panel-body fixed-panel">fdoinfds sdofjohisdfj</div></div>
Hope this helps with your need.
Solution 2:
HTML :
<divclass="span4"><divclass="panel panel-primary"><divclass="panel-heading">jhdsahfjhdfhs</div><divclass="panel-body panel-height">fdoinfds sdofjohisdfj</div></div></div>
CSS :
.panel-height {
height: 100px; / change according to your requirement/
}
Post a Comment for "How To Make Bootstrap Panel Body With Fixed Height"