text-align:left;right;center;justify; : text align « CSS « HTML / CSS






text-align:left;right;center;justify;

 
<?xml version="1.0" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">

<head>
  <title>CSS Example</title>
<style type='text/css'>
body {
   color:#000000;
   background-color:#ffffff;
   font-family:arial, verdana, sans-serif; 
   font-size:12px;}

div {width:500px;margin:10px;}

.leftAlign {text-align:left;}
.rightAlign {text-align:right;}
.center {text-align:center;}
.justify {text-align:justify;}
</style>

</head>

<body>

  <h1>text-align</h1>
  <div class="leftAlign">Here is some left-aligned text</div>
  <div class="rightAlign">Here is some right-aligned text</div>
  <div class="center">Here is some centered text</div>
  <div class="justify">Here is some justified text, this example requires at least three lines of text so that you can see the true effect that the justify property has. Here is some text, this example requires at least three lines of text so that you can see the true effect that the justify property has.</div>

</body>
</html>

   
  








Related examples in the same category

1.The text-align Property
2.'text-align' Example
3.text-align all possible values
4.text-align: justify
5.text-align:right;
6.text-align:left;
7.text align center
8.text-align: left;
9.text-align: center;
10.text-align: right;
11.text-align: justify;
12.Right align text
13.Text flows out of the boundaries