javascript - Resize pre element by dragging - Stack Overflow

I'd like the user to resize the pre elements in my AngularJS page by dragging the bottom border. T

I'd like the user to resize the pre elements in my AngularJS page by dragging the bottom border. The effect I aim to achieve is a very similar way to the way the textarea I am using now stackoverflow, but only to read the text written in the pre more effectively.

This is the simple piece of AngularJS code

<div class="container">
    <div class="jumbotron">
        <div class="row">
            <div class="col-md-6">
                First variable
                <pre>{{first}}</pre>
            </div>
            <div class="col-md-6">
                Second variable
                <pre>{{second}}</pre>
            </div>
        </div>
    </div>
</div>

The css bit associated with the pre is the following

pre {
  tab-size: 2;
  text-align : left;
  height: auto;
  max-height: 240px;
  overflow: auto;
  word-break: normal !important;
  word-wrap: normal !important;
  white-space: pre !important;
};

What I would like to have is to be able to resize the height of either pre to show more content.

I took a look at this example thinking that I can maybe work on resizing the divs containing the pre. Unfortunately I cannot make it work, but I am not even sure that was the right way.

I'd like the user to resize the pre elements in my AngularJS page by dragging the bottom border. The effect I aim to achieve is a very similar way to the way the textarea I am using now stackoverflow, but only to read the text written in the pre more effectively.

This is the simple piece of AngularJS code

<div class="container">
    <div class="jumbotron">
        <div class="row">
            <div class="col-md-6">
                First variable
                <pre>{{first}}</pre>
            </div>
            <div class="col-md-6">
                Second variable
                <pre>{{second}}</pre>
            </div>
        </div>
    </div>
</div>

The css bit associated with the pre is the following

pre {
  tab-size: 2;
  text-align : left;
  height: auto;
  max-height: 240px;
  overflow: auto;
  word-break: normal !important;
  word-wrap: normal !important;
  white-space: pre !important;
};

What I would like to have is to be able to resize the height of either pre to show more content.

I took a look at this example thinking that I can maybe work on resizing the divs containing the pre. Unfortunately I cannot make it work, but I am not even sure that was the right way.

Share Improve this question asked Aug 12, 2015 at 14:13 user1472709user1472709 1333 silver badges14 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 8

Give the pre these rules:

pre {
  resize: both;
  overflow: auto;
}

Snippet

pre {
  resize: both;
  overflow: auto;
  height: 70px;
  width: 150px;
}
<pre>#include "me.h";
#include "conio.h";</pre>

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745345703a4623531.html

相关推荐

  • javascript - Resize pre element by dragging - Stack Overflow

    I'd like the user to resize the pre elements in my AngularJS page by dragging the bottom border. T

    11小时前
    20

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信