
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Include Attributes for Table Columns in HTML
Use the <col> tag to include attributes for table columns. The HTML <col> tag allows authors to group together attribute specifications for table columns. It does not group columns together structurally -- that is the role of the <colgroup> element.
The following are the attributes −
Attribute |
Value |
Description |
---|---|---|
Align |
right left center justify char |
Defines horizontal alignment, not supported in Html5. |
Char |
character |
Defines a character to use to align text on (use with align = "char"), not supported in Html5. |
Charoff |
pixel |
Specifies an alignment offset (either in pixels or percentage value) against the first character as specified with the char attribute, not supported in Html5 |
Span |
number |
Defines the number of columns the <col> should span, not supported in Html5. |
Valign |
bottom middle top baseline |
Defines vertical alignment, not supported in Html5. |
Width |
pixels or % |
Specifies a default width for each column spanned by the current col element, not supported in Html5 . |
Example
You can try to run the following code to implement <col> tag −
<!DOCTYPE html> <html> <head> <title>HTML col Tag</title> </head> <body> <p>This example shows a colgroup that has three columns of different widths:</p> <table border = "1"> <colgroup span = "4"> <col width = "40"></col> <col width = "70"></col> <col width = "100"></col> <col width = "130"></col> <col width = "160"></col> </colgroup> <tr> <td>One</td> <td>Two</td> <td>Three</td> <td>Four</td> <td>Five</td> </tr> </table> </body> </html>
Advertisements