Open In App

What is use of text-center Class in Bootstrap ?

Last Updated : 19 Feb, 2024
Improve
Improve
Like Article
Like
Save
Share
Report

The .text-center class in Bootstrap is employed to horizontally centre-align text or content within its parent element. It ensures that text and other inline or inline-block elements are centred within their container, providing a visually appealing layout.

Syntax:

<div class="text-center">
<!-- Text or content to be centered goes here -->
</div>

Explanation: When applied to a <div> or other block-level element, the .text-center the class centres the text or content within that element horizontally. This class is especially useful for aligning headings, paragraphs, buttons, or other content elements in the centre of a container, improving the overall visual balance and alignment of the webpage.

Features

  • .text-center class centres text or content horizontally.
  • Ensures consistent alignment and readability.
  • Responsive design adapts to different screen sizes.
  • Enhances visual appeal and user experience.

Ref: https://www.geeksforgeeks.org/bootstrap-5-text-alignment/


Like Article
Suggest improvement
Share your thoughts in the comments

Similar Reads