HTML | Align Attribute - GeeksforGeeks

Skip to content geeksforgeeks
  • Courses
    • DSA Courses
    • Programming Languages
  • Tutorials
    • Python Tutorial
      • Python Loops and Control Flow
    • Java
      • Java Interview Questions
      • Java Quiz
      • Advance Java
    • Programming Languages
    • System Design
    • Interview Corner
    • Computer Science Subjects
    • DevOps
    • Linux
    • Software Testing
    • Databases
    • Android
    • Excel
    • Mathematics
  • DSA
    • Data Structures
    • Algorithms
      • Analysis of Algorithms
      • Searching Algorithms
      • Sorting Algorithms
    • Practice
      • Company Wise Coding Practice
      • Practice Problems Difficulty Wise
      • Language Wise Coding Practice
      • Curated DSA Lists
    • Company Wise SDE Sheets
    • DSA Cheat Sheets
    • Puzzles
  • Data Science
    • Data Science Packages
    • Data Visualization
    • Data Analysis
  • Web Tech
    • Web Development Using Python
      • Django
      • Flask
    • Cheat Sheets
  • HTML Tutorial
  • HTML Exercises
  • HTML Tags
  • HTML Attributes
  • Global Attributes
  • Event Attributes
  • HTML Interview Questions
  • HTML DOM
  • DOM Audio/Video
  • HTML 5
  • HTML Examples
  • Color Picker
  • A to Z Guide
  • HTML Formatter
Open In App HTML | <colgroup> align Attribute Last Updated : 17 Dec, 2021 Summarize Comments Improve Suggest changes Like Article Like Save Share Report Follow

The HTML <colgroup> align attribute is used to set the horizontal alignment of the text or content in the group of column. Syntax:

<colgroup align="left|right|center|justify|char>

Attribute Values:

  • left: It sets the content to the left-align.
  • right: It sets the content to the right-align.
  • center: It sets the content to the center.
  • justify: It stretches the lines and divided the content equally.
  • char: It sets the content to a specific character.

Example:

html

<!DOCTYPE html> <html> <head> <title> HTML ColumnGroup align Attribute </title> <style> #myColGroup { background: green; } table { color: white; margin-left: 180px; background: yellow; } #Geek_p { color: green; font-size: 30px; } td { padding: 10px; } h1, h2 { text-align:center; } </style> </head> <body> <h1 style="color:green;"> GeeksForGeeks </h1> <h2> HTML ColumnGroup align Attribute </h2> <table> <colgroup id="myColGroup" span="3" align = "left"> </colgroup> <tr> <th>S.No</th> <th>Title</th> <th>Geek_id</th> </tr> <tr> <td>Geek_1</td> <td>GeekForGeeks</td> <th>Geek_id_1</th> </tr> <tr> <td>Geek_2</td> <td>GeeksForGeeks</td> <th>Geek_id_2</th> </tr> </table> </body> </html>

Output:

Supported Browsers: The <colgroup> align attribute is not supported by any browsers. Now use CSS instead.

Comment More info Next Article HTML | <col> align Attribute

H

hritikbhatnagar2182 Follow Improve

Similar Reads

  • HTML | <colgroup> align Attribute The HTML <colgroup> align attribute is used to set the horizontal alignment of the text or content in the group of column. Syntax: <colgroup align="left|right|center|justify|char> Attribute Values: left: It sets the content to the left-align.right: It sets the content to the right-align. 1 min read
  • HTML | <col> align Attribute The HTML <col> align Attribute is used to set the horizontal alignment of text content inside the col element. It is not supported by HTML 5. Syntax: <col align="left | right | center | justify | char"> Attribute Values: left: It sets the text left-align. right: It sets the text right-al 1 min read
  • HTML <colgroup> char Attribute The HTML <colgroup> char Attribute is used to set the alignment of the content in a column group in a character. It can only be used if the align attribute is set to "character". The default worth of char is that the decimal-point character of the page language.Syntax: <colgroup char="chara 1 min read
  • HTML | <colgroup> span Attribute The HTML <colgroup> span Attribute is used to define the number of column that a <colgroup> element should span. Syntax: <colgroup span="number"> Attribute Values: number: It contains the numeric value which specifies the number of col element should span. Example: C/C++ Code & 1 min read
  • HTML | <caption> align Attribute The HTML <caption> align Attribute is used to specify the alignment of the <caption> Element. It is used to align the caption to the left, right, top and Bottom of a table. This attribute is not supported in HTML5. Note: By default , the table caption is aligned to center. Syntax: <ca 2 min read
  • HTML <p> align Attribute The HTML <p> tag is used to define paragraphs of text. In earlier versions of HTML, the align attribute was used to control the horizontal alignment of paragraph content. However, the align attribute for the <p> tag is deprecated in HTML5. Today, developers are encouraged to use CSS for 3 min read
  • HTML <div> align Attribute The HTML <div> align attribute was used to specify the horizontal alignment of content within a <div> element. However, this attribute is no longer supported in HTML5. Today, we use CSS for alignment purposes. Note: This attribute is not supported by HTML5. Syntax<div align="left | ri 3 min read
  • HTML <colgroup> width Attribute The HTML <colgroup> width Attribute is used to specify the width of the colgroup element. The <colgroup> attribute sets a predefined width of the column group. Syntax<colgroup width="pixels|%|relative_lngth">Attribute ValuesValue Description pixels It specify the width of the colgr 1 min read
  • HTML | <colgroup> valign Attribute The HTML <colgroup> valign Attribute is used to specify the vertical alignment of text content in a colgroup Element. Syntax: <colgroup valign="top | middle | bottom | baseline"> Attribute Values top: It sets the content to top-align. middle: It sets the content to middle-align. bottom: 1 min read
  • HTML <td> align Attribute The HTML <td> align attribute is used to set the horizontal alignment of text content. It uses the align attribute in HTML <td> to horizontally align text content within a table cell and it sets "left," "center," or "right" to control horizontal alignment. Note: The <td> align attr 2 min read
  • HTML <th> align Attribute The HTML <th> align Attribute is used to set the horizontal alignment of text content inside the table header cell. Instead, use CSS for alignment properties such as text-align to specify the horizontal alignment and vertical-align for vertical alignment within table headers. Note: The align a 2 min read
  • HTML <tr> align Attribute The HTML <tr> align Attribute is used to set the horizontal alignment of text content inside the table row. The HTML <tr> element itself doesn't have an align attribute. For aligning content within a table row, use the CSS text-align property on the individual <td> or <th> el 1 min read
  • HTML <colgroup> charoff Attribute The HTML <colgroup> element's charoff attribute specifies the offset (in characters) for alignment when the char attribute is used. It is applied to control character-based alignment in tables. This attribute is now deprecated in HTML5. Syntax<colgroup charoff="number">Attribute Valuesnu 2 min read
  • HTML <img> align Attribute The HTML <img> align attribute sets an image's alignment relative to surrounding elements, allowing horizontal or vertical positioning. It is deprecated in HTML5 and replaced by CSS properties like float and vertical alignment for more flexible and modern alignment options. Note: The align att 3 min read
  • HTML <hr> align Attribute The HTML <hr> align Attribute is used to specify the alignment of the horizontal line. If the width attribute is not set to 100% then the align attribute will not create any effect. Note: The <hr> align Attribute is not supported by HTML5. Syntax: <hr align="left | center | right"> 1 min read
  • HTML | <thead> align Attribute The HTML <thead> align attribute is used to set the horizontal alignment of text content inside the table head (thead) section. Syntax: <thead align="left|right|center|justify|char"> Note: This attribute has been DEPRECATED and is no longer recommended. Attribute Value: left: It sets the 1 min read
  • HTML | <tbody> align Attribute The HTML <tbody> align Attribute is used to set the horizontal alignment of text content inside the table body (tbody). Syntax: <tbody align="left | right | center | justify | char"> Attribute Value: left: It sets the text left-align. right: It sets the text right-align. center: It sets 1 min read
  • HTML <table> align Attribute The HTML <table> align Attribute is used to specify the alignment of the table and its content. Instead of the align attribute, CSS properties like margin and text-align are preferred for table alignment. For aligning content within table rows or cells, use the align attribute within <tr 2 min read
  • HTML <input> align Attribute The HTML <input> align attribute is used with <input type=” image”> to set the horizontal alignment of the image. It is not supported by HTML 5. Note: Since <input type=” image”> is not supported by HTML5 you can use CSS there instead of this attribute. The syntax for CSS <input 1 min read
Article Tags :
  • HTML
  • Web Technologies
  • HTML-Attributes
Like three90RightbarBannerImg Explore More We use cookies to ensure you have the best browsing experience on our website. By using our site, you acknowledge that you have read and understood our Cookie Policy & Privacy Policy Got It ! Lightbox Improvement Suggest changes Suggest Changes Help us improve. Share your suggestions to enhance the article. Contribute your expertise and make a difference in the GeeksforGeeks portal. geeksforgeeks-suggest-icon Create Improvement Enhance the article with your expertise. Contribute to the GeeksforGeeks community and help create better learning resources for all. geeksforgeeks-improvement-icon Suggest Changes min 4 words, max CharLimit:2000

What kind of Experience do you want to share?

Interview Experiences Admission Experiences Career Journeys Work Experiences Campus Experiences Competitive Exam Experiences

Từ khóa » Html Colgroup Align Right