
- HTML Tutorial
- HTML - Home
- HTML - Overview
- HTML - Basic Tags
- HTML - Elements
- HTML - Attributes
- HTML - Formatting
- HTML - Phrase Tags
- HTML - Meta Tags
- HTML - Comments
- HTML - Images
- HTML - Tables
- HTML - Lists
- HTML - Text Links
- HTML - Image Links
- HTML - Email Links
- HTML - Frames
- HTML - Iframes
- HTML - Blocks
- HTML - Backgrounds
- HTML - Colors
- HTML - Fonts
- HTML - Forms
- HTML - Embed Multimedia
- HTML - Marquees
- HTML - Header
- HTML - Style Sheet
- HTML - Javascript
- HTML - Layouts
- HTML References
- HTML - Tags Reference
- HTML - Attributes Reference
- HTML - Events Reference
- HTML - Fonts Reference
- HTML - ASCII Codes
- ASCII Table Lookup
- HTML - Color Names
- HTML - Entities
- HTML - Fonts Ref
- HTML - Events Ref
- MIME Media Types
- HTML - URL Encoding
- Language ISO Codes
- HTML - Character Encodings
- HTML - Deprecated Tags
How to set Heading alignment in HTML?
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>
- Related Articles
- How to set Text alignment in HTML?
- How do we set the alignment according to surrounding elements in HTML?
- How to create table heading in HTML?
- HTML Heading
- How to add sub heading using HTML?
- HTML DOM Heading object
- How to set alignment to text in text flow layout?
- How to set vertical alignment for a component in Java?
- How to set the text alignment in IText using FabricJS?
- Set Bootstrap Panel with Heading
- How to set the alignment of Check Mark in CheckBox in C#?
- How to set the horizontal alignment of text with JavaScript?
- How to set the text alignment of Text using FabricJS?
- How to set the alignment of text in a Textbox using FabricJS?
- Set Text Alignment using CSS
