Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Fix the size of <Pre> and make scrollable in html

Tags:

html

css

scroll

pre

I used < Pre > to show my json data in Modal. But < pre > became different size according to the json size. I want to fix the < pre > height. If json is bigger, it will show by scroll.

Here is my Modal .

<div class="modal-content json-modal-body" id="full-width" ng-controller="projectdetailsController">

    <div class="modal-header modal-header-confirm">
        <h4 class="modal-title ng-binding">
            <span class="glyphicon glyphicon-indent-left"></span>{{modalOptions.headerText}}
        </h4>
    </div>

    <div class="modal-body"> 

         <pre ng-bind-html="json | prettifyFilter"></pre>

    </div>

</div>

When the json is empty. It becomes like this enter image description here

How can i do this ?


1 Answers

Try This:

<style>
 div.scroll {
    width: 100px;
    height: 100px;
    overflow: scroll;
 }
</style>

See, if that solves your problem.

like image 153
Gaurav Dave Avatar answered Oct 26 '25 06:10

Gaurav Dave



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!