Home HTML 4 Ways to Bring Your Text in a Center Using HTML

4 Ways to Bring Your Text in a Center Using HTML

0
4 Ways to Bring Your Text in a Center Using HTML

If you are using HTML I don’t know why your text is not coming in center. Either applied according to the HTML elements. So, on this page, you will learn 4 ways to bring a text to the center let’s begin!

Contents

Text At the Center Using HTML

Many people generally used it for the title of a website or document. you can also use just put whatever you want between <center></center> tags: see the example below!

<center> element

       
<center>This is heading</center>

The second way is:

Using style sheet

You can be used also the style sheet property:

For doing the text in the center use CSS by specifying the text-align property of an element.

If you have only one or a few blocks of text to center, add the <style> </style> attribute to the element’s opening tag and use the “text-align” property. see the example below!


p{

text-align: center;

}

Centering a few blocks of text

If you have many blocks of text to center, use CSS inside <style></style> tags in the head section or in an external style sheet. See the example code below for how to set all text inside the <span></span> tags to be centered.


<span style="text-align: center>This text is in center </span>

Text of multiple blocks:

If you’re creating a center class, as shown was in the example above, a paragraph can be centered using the code below, which “calls” the center class.


<p class="center">This text is in center</p>

Keep reading: How to Add HTML Space Between Buttons?

LEAVE A REPLY

Please enter your comment!
Please enter your name here