All TalkersCode Topics

Follow TalkersCode On Social Media - A Social Media Network for developers Join Now ➔

How To Create A Box In HTML With Text

Last Updated : Mar 11, 2024

How To Create A Box In HTML With Text

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>
          <title> Title of the document<title>
       <textarea name="textarea" cols="30" rows="10">

	<textarea name="textarea" cols="50" rows="3">
The text written between these tags is shown in webpage and also , within border.

  1. First, we write <! DOCTYPE html> which we used as an instruction to the web browser about what version of HTML file is written in.
  2. Secondly, the <html> tag is used to indicate the beginning of an HTML document.
  3. 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.
  4. 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.
  5. Generally, we not have to write code in between these tags because the text written between these tags is shown on webpages.
  6. 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.
  7. 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.
  8. You can also able to change height and width as specified.
  9. At last, the <body> and <html> tags are closed with </body> and </html> respectively.

Conclusion :-

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.

Author Image About Anjali

Experienced Computer Programmer with a broad range of experience in technology. Strengths in application development and Object Oriented architecture design, front end programming, usability and multimedia technology. Expert in coding languages such as C, C++ Java, JavaScript, PHP and more.

Follow Anjali On Linkedin 🡪