Home >Web Front-end >CSS Tutorial >How to Center Content in Twitter Bootstrap?
How to Center Content using Twitter Bootstrap
In Twitter Bootstrap, you can achieve centered content through methods that vary depending on your specific requirements.
Centering Text
To align text in the center, you can apply the .text-center class to the parent container. This class, introduced in Bootstrap 2.3.0, allows for effortless text centering.
<div class="text-center"> <h1>Bootstrap Starter Template</h1> <p>Example text.</p> </div>
Notes:
Alternative Methods for Non-Text Content
For centering non-text elements (e.g., images or buttons), you have the following options:
Choose the method that best suits your specific needs and version of Bootstrap.
The above is the detailed content of How to Center Content in Twitter Bootstrap?. For more information, please follow other related articles on the PHP Chinese website!