5

I am creating a simple text editor - the text input is a textarea element. I want to remove the two lines used to change the box size (in fact, if possible, I'd like to fix the box size so it can't be changed).

This is what I'm talking about: enter image description here

EDIT: Here's the code:

// HTML
<textarea id="canvas" placeholder="Write something..."></textarea>

// CSS
#canvas {
  border: 1px dashed #999;
  background: transparent;
  width: 500px;
  height: 400px;
  margin: 0 auto;
  padding: 5px;
  font-size: 20px;
}
Ben Thomas
  • 3,180
  • 2
  • 20
  • 38
tbd_
  • 1,058
  • 1
  • 16
  • 39

2 Answers2

8

You can try CSS properties resize and appearance:

#textbox {
    border: 1px dashed #999;
    background: transparent;
    width: 500px;
    height: 400px;
    margin: 0 auto;
    padding: 5px;
    font-size: 20px;

    resize:none;

    -webkit-appearance: textfield;
    -moz-appearance: textfield;
    appearance: textfield;
}
<textarea id="textbox" placeholder="Write something..."></textarea>
Bharata
  • 13,509
  • 6
  • 36
  • 50
4

Add the property resize:none to the textarea. Here is the working code:

#canvas {
    border: 1px dashed #999;
    background: transparent;
    width: 500px;
    height: 400px;
    margin: 0 auto;
    padding: 5px;
    font-size: 20px;
    resize:none;
}
<textarea id="canvas" placeholder="Write something..."></textarea>

Hope this helps!

Arex
  • 674
  • 3
  • 10