oldoc63 / learningHTML

Learning HTML with Codecademy and GitHub
0 stars 0 forks source link

Our users want to write a blog. Let make a Textarea element! #20

Closed oldoc63 closed 3 years ago

oldoc63 commented 3 years ago

An input element with type="text" creates a single row input field for users to type in information. However, there are cases where users need to write in more information, like a blog post. In such cases, instead of using an input, we could use textarea.

The textarea element is used to create a bigger text field for users to write more text. We can add the attributes rows and cols to determine the amount of rows and columns for the textarea.

<form>
  <label for="blog">New Blog Post: </label>
  <br>
  <textarea id="blog" name="blog" rows="5" cols="30">
  </textarea>
</form>
oldoc63 commented 3 years ago

If we wanted an even bigger text field, we could click and drag on the bottom right corner to expand it.

When we submit the form, the value of textarea is the text written inside the box. If we want to add a default value to textarea we would include it within the opening and closing tags.

<textarea>Adding default text</textarea>