What is the default value for the "resize" attribute in a textarea?

Asked

Viewed 228 times

10

How to leave a textarea adjustable after it was set "resize: None"?

For example, I have a textarea which has a value defined as resize:none in CSS, but I want to leave the default value by placing an inline snippet.

.my_textarea{
   border: 2px solid pink;
   resize: none;
   width: 300px;
   height: 100px;
}
<textarea class="my_textarea"></textarea>

What is the default value for the "resize" attribute in a textarea?

3 answers

8


The default value is: auto.

resize: auto;

How do we know this ? We can see in user agent stylesheet browser.

textarea {
    -webkit-appearance: textarea;
    background-color: white;
    -webkit-rtl-ordering: logical;
    user-select: text;
    flex-direction: column;
    resize: auto; /* Aqui */
    cursor: auto;
    white-space: pre-wrap;
    word-wrap: break-word;
    border-width: 1px;
    border-style: solid;
    border-color: initial;
    border-image: initial;
    padding: 2px;
}

3

Another way to do this is by using the value both.

Behold:

.my_textarea{
   border: 2px solid pink;
   resize: none;
   width: 300px;
   height: 100px;
}
<textarea class="my_textarea"></textarea>
<textarea class="my_textarea" style="resize: both"></textarea>

Remembering that this is not the default value, but that causes it to behave in the way that usually the textarea is configured by default.

According to the W3school:

Both: The user can Adjust Both the height and the width of the element

3

According to the MDN:

Gecko 2.0 introduced support for resizable textareas. This is Controlled by the resize CSS Property. Resizing of textareas is enabled by default...

Translating gets:

Gecko 2.0 introduced support for resizable textareas. This is controlled by the resizing CSS property. Resizing textareas is enabled by default...

That according to the discovery from @Diegosouza, the default value for enabled is auto.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.