Set text align for paragraph to center in HTML and CSS

Description

The following code shows how to set text align for paragraph to center.

Example


<html>
<head>
<style>
.dotted {<!--from   www.  ja v  a2s  .  c  o  m-->
border-color: red;
border-width: medium;
border-style: dotted;
text-align: center;
}

</style>
</head>
<body>
<p class="dotted"> asdf asdf asdf adsf Dotted</p>

</body>
</html>

Click to view the demo

The code above generates the following result.

Set text align for paragraph to center in HTML and CSS
Home »
  HTML CSS Tutorial »
    Text »
      Paragraph
HTML CSS Tutorial Paragraph
Add line break to a paragraph in HTML and C...
Add margin to paragraph in HTML and CSS
Add shading border for paragraph in HTML an...
Create Paragraphs in HTML and CSS
Create three Paragraphs in HTML and CSS
Demonstrate White Space Collapsing and Line...
Float a paragraph right and make text above...
Float image to left and right, then start n...
Float paragraph in HTML and CSS
Set text align for paragraph to center in H...
Use different border style to highlight wor...
Use margin to align and move a paragraph in...