input tag formatting code example

Example 1: html text box

<!-- A <textarea> tag (better for multi-line text)-->
<textarea cols="4" rows="5">
Some text inside the text box.  
See https://www.w3schools.com/tags/tag_textarea.asp
</textarea>

<!-- An <input> type text tag (better for single-line text) -->
<input type="text" value="Some text inside the text box">
<!-- See https://www.w3schools.com/tags/att_input_type_text.asp -->

<!-- Using contenteditable (not recommended) -->
<p contenteditable="true">Some text inside the text box</p>
<!-- See https://www.w3schools.com/tags/att_global_contenteditable.asp -->

Example 2: input type file pattern attribute in html

<input type="file" name="my-image" id="image" accept="image/gif, image/jpeg, image/png" />
To select only image files, you can use this accept="image/*"

<input type="file" name="my-image" id="image" accept="image/*" />

Tags:

Html Example