How to set text alignment

Example analysis:

The text-align attribute specifies the horizontal alignment of the element's text.

You can set the following horizontal alignment:

●Left: Arrange the text to the left. Default: determined by the browser.​

● Right: Arrange the text to the right.

● Center: Arrange the text to the middle.

●Justify: To achieve the effect of aligning text on both ends.



Continuing Learning
||
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>php(php.cn)</title>
<style>
h1 {text-align:center;}
p.date {text-align:right;}
p.main {text-align:justify;}
</style>
</head>
<body>
<h1>CSS text-align </h1>
<p class="date">2015 3 14 </p>
<p class="main">“
    
    
    ?
    </p>
<p><b></b> "justify" </p>
</body>
</html>
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
submitReset Code
图片放大关闭