How to Center Text in Html – Website Development Tutorial

Intro:
Today, we’re going to teach you how to center text in Html, everything you need to know as a beginner, so without any further delay let’s begin…
How To Center Text In Html
The first thing that we need is a basic HTML file, that has head and body tags and also, we need some text to format inside the body. Once you’re ready with your basic HTML file let’s dive into other steps.
No 01: Introduce a New Html Tag
In a basic HTML file, you need to introduce a new HTML tag, the paragraph tag.Just type an opening p tag <p>, and a closing p tag </p>.Then, add some text in between them. Create another opening and closing paragraph tag, and add text for a second paragraph. Now, go to your browser and refresh it. This tag will make a double line break, so you have a very defined space between your paragraphs.
No 02: Two Ways to Center The Text
Basically, there are two ways to center the text. You can use the align attribute inside an existing tag, or you could use the center tag. If you use the align, you are getting additional attributes to your paragraph tag.
When you add a new attribute to your tag, you will need to specify the value that the parameter will hold. In this case, the alignment can be either left, right, or center. For this case, write align equals center, and wrap the center word with double-quotes (ex. align = “center”).
Now, refresh the browser again, and you will see that the first paragraph is centered, while the second one is not. The align attribute can be used inside many HTML tags, such as the body tag, that would make all of the text in the web page centered. It can also be used inside tables, or columns, where this becomes very useful.
Hope so guys you liked reading this article. I tried my best as much as possible ways to make you understand everything clearly so hopefully, this article is gonna be helpful for you in how to center text in Html. Keep visiting us to learn many more things. Have a nice day!