HTML Code For Paragraphs and Headings

Learn HTML code for paragraphs and headings tutorial.


<!DOCTYPE html>
<html>
<head>
<title>Page Title</title>
</head>
<body>

<h1>This is a Heading</h1>
<p>This is a paragraph.</p>

</body>
</html>

HTML Code Displays

This is a Heading

This is a paragraph.



H1 to H6 Head Tags

'h1' defines the most important heading. 'h6' defines the least important heading.


<!DOCTYPE html>
<html>
<head>
<title>Page Title</title>
</head>
<body>

<h1>This is heading 1</h1>
<h2>This is heading 2</h2>
<h3>This is heading 3</h3>
<h4>This is heading 4</h4>
<h5>This is heading 5</h5>
<h6>This is heading 6</h6>

</body>
</html>

HTML Code Displays

This is heading 1

This is heading 2

This is heading 3

This is heading 4

This is heading 5
This is heading 6


Text Alignment

The CSS text-align property defines the horizontal text alignment for an HTML element:


<!DOCTYPE html>
<html>
<head>
<title>Page Title</title>
</head>
<body>

<h1 style="text-align:center;">Centered Heading</h1>
<p style="text-align:center;">Centered paragraph.</p>

</body>
</html>

HTML Code Displays

Centered Heading

Centered paragraph.



HTML 'Bold' and 'Strong' Elements

The HTML 'b' element defines bold text, without any extra importance. The HTML 'strong' element defines text with strong importance. The content inside is typically displayed in bold.


<!DOCTYPE html>
<html>
<head>
<title>Page Title</title>
</head>
<body>

<b>This text is bold</b>
<strong>This text is important!</strong>

</body>
</html>

HTML Code Displays

This text is bold
This text is important!


HTML 'i' and 'em' Elements

The HTML 'i' element defines a part of text in an alternate voice or mood. The content inside is typically displayed in italic.

The HTML 'em' element defines emphasized text. The content inside is typically displayed in italic.


<!DOCTYPE html>
<html>
<head>
<title>Page Title</title>
</head>
<body>

<i>This text is italic</i>
<em>This text is emphasized</em>

</body>
</html>

HTML Code Displays

This text is italic
This text is emphasized