Set text align to center : p text « Tags « HTML / CSS






Set text align to center

   

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<title></title>
<style type="text/css">

h1, h2, h3 {
 font-size: 200%;
 background-image: url(bkgd2.jpg);
 background-repeat: no-repeat;
 background-attachment: fixed;
 background-position: center;
 padding: 1.5em;
 text-align: center;
 color: white;
}

</style>
</head>

<body>
  <h1>header 1</h1>

  <p>This is a text. This is a text. This is a text. This is a text.
  This is a text. This is a text. This is a text. This is a text.
  This is a text. This is a text. This is a text. This is a text.
  This is a text. This is a text. This is a text. This is a text.
  This is a text. This is a text. This is a text. This is a text.
  This is a text. This is a text. This is a text. This is a text.</p>
</body>
</html>

   
    
  








Related examples in the same category

1.P width: 600px; text-align: justify;
2.p text-indent: 37%;
3.p text-indent: 2.5em;
4.p text-indent: -5em; text-indent: -60px; text-indent: -60px;
5.p text-indent: -5em;
6.P text-align: justify
7.Use style to hide text
8.Text is larger than wrapper box
9.Text is large, bold, and aligned at the baseline. Subsequent lines are not indented.
10.p text-decoration: underline;
11.p text-decoration: overline;
12.p text-decoration: line-through;
13.p text-decoration: blink;
14.p text-transform: none;
15.p text-transform: capitalize;
16.p text-transform: uppercase;
17.p text-transform: lowercase;
18.p text-align: right;
19.p text-align: center;
20.p text-align: justify;
21.p {text-align: left;text-align: right;text-align: center;
22.p text-indent: 25px;
23.p text-indent: 10%;
24.p text-indent: -15px;
25.p text-align: left;
26.p text-indent:3em;
27.Paragraph text is black and in 12pt font
28.Paragraph wraps text
29.text align to left
30.text-align:left, center, right
31.text-align: right;
32.text-align: left;
33.text-align: center;
34.Set text align to justify
35.Text alignment: center, left and justify