Add margin to paragraph in HTML and CSS

Description

The following code shows how to add margin to paragraph.

Example


<html>
<head>
<style type='text/css'>
p {<!-- w  ww .  j a v a2s. c  o m-->
margin-top:40px;
margin-bottom:10px;
margin-left:10px;
margin-right:10px;
border-style:solid;
border-width:1px;
border-color:#000000;}

strong {
margin-left:40px;
margin-right:10px;
background-color:#d6d6d6;
}
</style>

</head>

<body>
<p>Lorem ipsum dolor sit amet, consectetuer <strong>adipiscing</strong> elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad minim veniam, quis <strong>nostrud</strong> exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. </p>
<p>Lorem ipsum dolor sit amet, consectetuer <strong>adipiscing</strong> elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad minim veniam, quis <strong>nostrud</strong> exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. </p>
<p>Lorem ipsum dolor sit amet, consectetuer <strong>adipiscing</strong> elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad minim veniam, quis <strong>nostrud</strong> exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. </p>
</body>
</html>

Click to view the demo

The code above generates the following result.

Add margin to paragraph 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...