Q:

How to Align Text in Bootstrap

0

How to Align Text in Bootstrap

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

Use the Text-align Classes

Bootstrap framework has several built-in CSS classes that you can use to align text to the left, right, center inside a heading, paragraph, table, div elements and so on.

Let's try out the following example to understand how this basically works:

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Text-align Classes in Bootstrap</title>
<link rel="stylesheet" href="css/bootstrap.min.css">
<script src="js/jquery-3.5.1.min.js"></script>
<script src="js/bootstrap.min.js"></script>
</head> 
<body>
    <p class="text-left">This text is left aligned.</p>
    <p class="text-center">This text is center aligned.</p>
    <p class="text-right">This text is right aligned.</p>
    <p class="text-justify">This text is justified.</p>
</body>
</html>

The text alignment classes in the above example are supported in both Bootstrap 3 and 4 versions.

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

This question belongs to these collections

Similar questions


need a help?


find thousands of online teachers now