Search code examples
htmlcssexpander

css div height expender


i'm trying to put an textarea expander on a div and i can't find the right element to set , here explanation of what i'm trying to do :

in the textarea input tags in the bottom corner there is expander for the user to set the size he wants hes textarea to be

my question is , is there a way to put something like that on a div? i don't looking for javascript code , css or html would be great.


Solution

  • Use CSS3 resize: both;, as seen here: http://dhtmlexamples.com/2011/01/20/creating-a-user-resizable-div-tag-using-css3/

    <style type="text/css">
        .isResizable {
            background: rgba(255, 0, 0, 0.2);
            font-size: 2em;
            border: 1px solid black;
            overflow: hidden;
            resize: both;
            width: 160px;
            height: 120px;
            min-width: 120px;
            min-height: 90px;
            max-width: 400px;
            max-height: 300px;
        }
    </style>
    
    <div class="isResizable">The quick brown fox jumps over the lazy dog.</div>