HTML Headings

Headings are crucial elements in any HTML document, providing structure and organization to your content. <h1> represents the highest level heading. <h2>represents the second-highest level heading. Html Similarly, to represent lower levels of headings.

Example

Heading 1

Heading 2

Heading 3

Heading 4

Heading 5
Heading 6

HTML Headings

HTML headings are defined with the <h1> to <h6> tags.

<h1> defines the most important heading. <h6> defines the least important heading.

HTML Paragraphs

A paragraph always starts on a new line, and browsers automatically add some white space (a margin) before and after a paragraph.

Example

<p>This is a paragraph.</p>
<p>This is another paragraph.</p>

HTML Horizontal Rules

The <hr> tag defines a thematic break in an HTML page, and is most often displayed as a horizontal rule.

The <hr> element is used to separate content (or define a change) in an HTML page:

Example

<h1>This is heading 1</h1>
<p>This is some text.</p>
<hr>
<h2>This is heading 2</h2>
<p>This is some other text.</p>
<hr>

HTML Line Breaks

Html <br> element is used to create a line break within the paragraphs.

  • The text following <br> appears on a new line.

<p>This is<br>a paragraph<br>with line breaks.</p>

This is useful when you want to break a line without starting a new paragraph, such as in addresses, poems, or other cases where a new line doesn’t necessarily imply a new block of conten

 

HTML Styles

These are styles applied directly to an HTML element using the style attribute.
The attribute value takes a CSS-like syntax to define the desired properties and values.
While convenient for small changes, inline styles can hinder code maintainability and increase file size.
HTML

<p style="color: red; font-size: 20px;">This is red and large text.</p>

Background Color

background-color property defines the background color for an HTML element.

Example

<body style=”background-color:powderblue;”>

Try it Yourself »

Leave a Comment