How to set Heading alignment in HTML? (2024)

'; var adpushup = adpushup || {}; adpushup.que = adpushup.que || []; adpushup.que.push(function() { adpushup.triggerAd(ad_id); });

Headings are the titles or subtitles of the content that you want to display on the web page. Headings help us to get an idea of the content on the web page. Headings and subheadings represent the key concepts ideas and supporting ideas in the content of the web page. HTML have a different level of heading tags.

Heading is defined with <h1> to <h6> tags. It is important to use headings to show the HTML document structure. <h1> headings should be used for main headings, followed by <h2> headings, then <h3>, and so on up to <h6>.

Heading tags in HTML have <h1> to <h6> tags. To set the heading alignment in HTML, we use the style attribute inside an HTML element. The attribute is used with the HTML <h1> to <h6> tag, with the CSS property text-align for setting alignment for an element.

Syntax

Following is the syntax for the heading alignment in HTML.

<h1 align="left | right | center | justify">

Example

Following is the example program for the heading alignment in the center.

<!DOCTYPE html><html><body> <h1 align="center">Tutorials point </h1></body></html>

Heading alignment to left

We can align the heading to left by using the below syntax.

Syntax

Following is the syntax for the heading alignment on left.

<h1 align="left">The text…</h1>

Example

Following is the example program for the heading alignment on left.

<!DOCTYPE html><html><body> <h1 align="left">Tutorials point</h1></body></html>

Heading alignment to left

We can align the heading to right by using the below syntax.

Syntax

Following is the syntax for the heading alignment on right in HTML.

<h1 align="right">The text…</h1>

Example

Following is the example program for the heading alignment on right.

<!DOCTYPE html><html><body> <h1 align="right">Tutorials point</h1></body></html>

Heading alignment to justify

We can align the heading to justify by using the below syntax.

Syntax

Following is the syntax for the heading alignment in justify in HTML.

<h1 align="justify">The text…</h1>

Example

Following is the example program for the heading alignment in justify.

<!DOCTYPE html><html><body> <h1 align="justify">Tutorials point</h1></body></html>

Updated on: 02-Sep-2023

46K+ Views

Kickstart Your Career

Get certified by completing the course

Get Started

How to set Heading alignment in HTML? (31)

Advertisem*nts

';adpushup.triggerAd(ad_id); });

How to set Heading alignment in HTML? (2024)
Top Articles
Latest Posts
Article information

Author: Terence Hammes MD

Last Updated:

Views: 5807

Rating: 4.9 / 5 (69 voted)

Reviews: 92% of readers found this page helpful

Author information

Name: Terence Hammes MD

Birthday: 1992-04-11

Address: Suite 408 9446 Mercy Mews, West Roxie, CT 04904

Phone: +50312511349175

Job: Product Consulting Liaison

Hobby: Jogging, Motor sports, Nordic skating, Jigsaw puzzles, Bird watching, Nordic skating, Sculpting

Introduction: My name is Terence Hammes MD, I am a inexpensive, energetic, jolly, faithful, cheerful, proud, rich person who loves writing and wants to share my knowledge and understanding with you.