3

I've a text area in my html, and this has rounded edges. but when I click inside the text area, it is showing a rectangle around the rounded edges.

Below is my HTML.

<textarea placeholder="Enter Text Here..." id="usermsg" class="Textareausermsg" onclick="TextAreaToggle()" style="margin: 0px 0px 0px -50px; width: 490px; height: 41px;"></textarea>

and here is my CSS

.Textareausermsg {
    border-radius: 15px;
    font-size: 15px;
    text-align: left;
    line-height: 34px;
}

working fiddle https://jsfiddle.net/jrss9192/1/

Mazz
  • 1,859
  • 26
  • 38
user3872094
  • 3,269
  • 8
  • 33
  • 71

6 Answers6

5

Just remove the outline

.Textareausermsg {
    border-radius: 15px;
    font-size: 15px;
    text-align: left;
    line-height: 34px;
    outline: 0;
}
Mazz
  • 1,859
  • 26
  • 38
2

The rectangle that you are seeing is a browser-default outline. While its not a good idea to remove browser default styles, it can be done by declaring outline: none;

.Textareausermsg {
    border-radius: 15px;
    font-size: 15px;
    text-align: left;
    line-height: 34px;
    outline: none;
}
<textarea placeholder="Enter Text Here..." id="usermsg" class="Textareausermsg" style="margin: 0px 0px 0px -50px; width: 490px; height: 41px;"></textarea>
Tom
  • 2,543
  • 3
  • 21
  • 42
1

Use: outline: none when the textarea is focused

  textarea:focus{
    outline: none;
}
Yahya Hussein
  • 8,767
  • 15
  • 58
  • 114
1

That's outline of textarea appears on focus just set outline:0; on .Textareausermsg

.Textareausermsg {
    border-radius: 15px;
    font-size: 15px;
    text-align: left;
    line-height: 34px;
    outline:0;
}
<textarea placeholder="Enter Text Here..." id="usermsg" class="Textareausermsg" style="width: 260px; height: 41px;"></textarea>
Abhishek Pandey
  • 13,302
  • 8
  • 38
  • 68
0

The rectangled area is called "outline" and it's a css property. Try add outline: none; in your css code to remove it.

If you want a "blue border" when you click / focus the element, try this

.Textareausermsg {
    border-radius: 15px;
    font-size: 15px;
    text-align: left;
    line-height: 34px;
    outline: none;
}

.Textareausermsg:focus, .Textareausermsg:active {
    border:1px solid blue;
}

https://jsfiddle.net/jrss9192/2/

0

Here is the solution to your question.

 .Textareausermsg {
        border-radius: 15px;
        font-size: 15px;
        text-align: left;
        line-height: 34px;
        outline: none;
    }
    .Textareausermsg :active , .Textareausermsg :focus { outline:none}
Sahil Dhir
  • 4,162
  • 1
  • 13
  • 33