How to Center Text in HTML? Last Updated : 06 Nov, 2024 Comments Improve Suggest changes Like Article Like Report To center text in HTML, we can use CSS text-align: center property. It aligns the text to center horizontally. The <center> tag was used in older versions to center the text horizontally, but it is depreciated in HTML 5.Center Text using center TagThe <center> tag is a block-level element that is used to center text horizontally within its container element. HTML <center> <h1>GeeksforGeeks</h1> <p>This text is centered using the <center> tag.</p> </center> Outputcenter tagNote: The <center> tag is depricated from HTML 5, so we will use CSS text-align property to center the text.Center Text using text-align PropertyThe text-align property is the simplest way to horizontally center the text. It is suitable for both inline and block-level elements like paragraphs (<p>), headings (<h1> to <h6>), and divs (<div>). HTML <div style="text-align: center;"> <h1>GeeksforGeeks</h1> <p>This text is centered using text-align.</p> </div> Outputtext-align centerRelated Article: How to center text in CSS ? Comment More infoAdvertise with us Next Article How to Center Text in HTML? M maheshkadambala Follow Improve Article Tags : HTML HTML-Questions CSS-Questions Similar Reads How to Center Text in CSS? Text Centering ensures that the text appears in the middle of a container or the entire page, which can create a balanced and visually appealing layout. CSS can provide multiple ways to achieve text centering, depending on the context, such as horizontally or vertically centering within the containe 4 min read How to Align Text in HTML? In earlier versions of HTML, the align attribute was commonly used to align text to the left, right, or center. However, this attribute is now deprecated in HTML5 and should no longer be used in modern web development. Instead, text alignment is handled more effectively using CSS with the text-align 2 min read How to Center Form in HTML? In HTML, forms are typically displayed as a block element, taking up the full width of their container. While this is often desirable, there are times when you might want to center a form within its container for aesthetic or layout purposes. We will discuss different Methods to center form in HTML: 3 min read How to Center a Video in HTML ? Centering a video in HTML enhances the user interface, offering a cleaner and more organized appearance. We can achieve this effect with two different methods, by using the Flexbox and the "style" attribute. Below are the approaches to Center a Video in HTML: Table of Content Using the FlexboxUsing 2 min read How to Wrap Text in HTML? To wrap text in HTML, you can use the default behaviour of block-level elements like <p>, <div>, and <h1>, which automatically wrap text to fit within their parent container. For more control over text wrapping, you can use CSS properties like word-wrap, white-space, and overflow-w 3 min read Like