How To Create A Box In HTML With Text
Last Updated : Jul 1, 2023
IN - HTML
In this tutorial we will show you how to create a box in HTML with text, generally, most of times first a tag is written in code with its text and after that we provide a border to it with our CSS properties of borders.
You are able to find the example to previous line in our webpages. But, now here we have to create a box first, in which we are able to type or write text. The box in shown on webpage and on webpage we have to write text inside border, like forms.
Step By Step Guide On How To Create A Box In HTML With Text :-
1. By using textarea:
Textarea is the easiest way to make a box in which we can write our text. It is a paired tag and also, we are able to change its height and width according to user’s choice
<!DOCTYPE html> <html> <head> <title> Title of the document<title> </head> <body> <textarea name="textarea" cols="30" rows="10"> </textarea> <textarea name="textarea" cols="50" rows="3"> The text written between these tags is shown in webpage and also , within border. </textarea> </body> </html>
- First, we write <! DOCTYPE html> which we used as an instruction to the web browser about what version of HTML file is written in.
- Secondly, the <html> tag is used to indicate the beginning of an HTML document.
- As above now <head> tag is used to contain information about web page. In this tag a <title> tag is used which helps us to specify a webpage title. Both <head> and <title> tags are Paired tags. So, both have </head> and </title> ending tags respectively.
- Thirdly, <body> tag is used to define the webpage body. All the contents to show on website are written here. Now, here we use a tag known as textarea and the textarea as known is paired tag. Thus, it also has a closing tag.
- Generally, we not have to write code in between these tags because the text written between these tags is shown on webpages.
- Most of times, there is nothing in between these open and closing tags. The attributes used with these tags are name, id, rows and cols.
- Name is used to give name to tag, and id is used to link it with CSS and database. Where, rows are defined for its height and cols are for width.
- You can also able to change height and width as specified.
- At last, the <body> and <html> tags are closed with </body> and </html> respectively.
Now the result is that, textarea is used to able clients or user to enter text in between boxes showed on webpages.
These boxes may be a text box, feedback box, form and anything else. You can use this anywhere you want we also specify some more ways to enter text in further sessions. I hope this tutorial on how to create a box in HTML with text helps you.