Skip to content
Related Articles
Open in App
Not now

Related Articles

HTML | <div> align Attribute

Improve Article
Save Article
  • Last Updated : 03 Jun, 2022
Improve Article
Save Article

The HTML div align Attribute is used to specify the alignment of the <div> element or the content present inside the div Element.

Note : This attribute is not supported by HTML5.


<div align="left | right | center | justify";>

Attribute Values:

  • left: It sets the content to the left-align.
  • right: It sets the content to the right-align.
  • center: I sets the div element to the center. By default, it is set to center.
  • justify: It sets the content to the justify position.



<!DOCTYPE html>
    <title>HTML | <div> align Attribute
    <style type=text/css>
        p {
            background-color: gray;
            margin: 10px;
        div {
            color: white;
            background-color: 009900;
            margin: 2px;
            font-size: 25px;
        body {
            text-align: center;
    <h2>&lt;div&gt;align Attribute</h2>
    <div align="center">
      div align="center"
    <div align="left">
      div align="left"
    <div align="right">
      div align="right"
    <div align="justify">
      div align="justify"

Output :


Supported Browsers: The browsers supported by HTML div align Attribute are listed below:

  • Google Chrome
  • Internet Explorer
  • Firefox
  • Apple Safari
  • Opera

HTML is the foundation of webpages, is used for webpage development by structuring websites and web apps.You can learn HTML from the ground up by following this HTML Tutorial and HTML Examples.

My Personal Notes arrow_drop_up
Related Articles

Start Your Coding Journey Now!