SlideShare a Scribd company logo
1 of 10
HTML <col> Tag

Also known as the “column” tag
<col>
• Definition: defines attribute values for one or
  more columns in a table
  – Must be used inside a <table> or a <colgroup>
    element
<col>
• <col> sets properties for a column of table
  cells, such as this table
  – Column = vertical region
Placement
• <col> tag goes
   – after the <table> tag
   – before any <tr> (table row), <thead> (table
     head), or <tbody> (table body) elements

• May go inside <colgroup> element, but doesn’t have
  to
Example usage and result
<table border="1">
 <colgroup>

  <col span="2" style="background-color:red" />
  <col style="background-color:yellow" />
 </colgroup>
 <tr>
  <th>ISBN</th>
  <th>Title</th>
  <th>Price</th>
 </tr>
 <tr>
  <td>3476896</td>
  <td>My first HTML</td>
  <td>$53</td>
 </tr>
 <tr>
  <td>5869207</td>
  <td>My first CSS</td>
  <td>$49</td>
 </tr>
</table>
<col>
• Required attributes?
  – NONE
• Optional attributes?
  – align
  – char
  – charoff
  – span
  – valign
  – width
<col> Attribute values
• span
  – number (of columns) the <col> element should span
     • for example
     <col span=“2”>
<col> Attribute values
• align
  – text alignment inside column
     • left, right, center, justify, char
     <col align=“center”>
<col> Attribute values
• width (fixes the width of the column)
   – %
   – pixels
   – relative_length
      • for example (pixels)…
          <col width=“100”>
In conclusion…
• Important!
• <col> does NOT create columns
  – it sets the properties for the columns to be
    defined LATER IN THAT CODE

More Related Content

Viewers also liked

Flying The Kites
Flying The KitesFlying The Kites
Flying The KitesWim Rutten
 
Reporte de afiches y promociones kerly
Reporte de afiches y promociones kerlyReporte de afiches y promociones kerly
Reporte de afiches y promociones kerlyjmedinace
 
I-COMference'12_Geisherik
I-COMference'12_GeisherikI-COMference'12_Geisherik
I-COMference'12_Geisherikklueva_olya
 
I-COMference'12_Serikova
I-COMference'12_SerikovaI-COMference'12_Serikova
I-COMference'12_Serikovaklueva_olya
 
Munteanu murgoci georg, popa-burcă ion - românia şi ţările locuite de români
Munteanu murgoci georg, popa-burcă ion - românia şi ţările locuite de româniMunteanu murgoci georg, popa-burcă ion - românia şi ţările locuite de români
Munteanu murgoci georg, popa-burcă ion - românia şi ţările locuite de româniDejavue666
 
Vac Pac and Reynolon
Vac Pac and ReynolonVac Pac and Reynolon
Vac Pac and Reynolonfarisfahed
 
Suresh &amp; Theory U
Suresh &amp; Theory USuresh &amp; Theory U
Suresh &amp; Theory UWim Rutten
 
planificaciones Guia ef
planificaciones Guia efplanificaciones Guia ef
planificaciones Guia efRafael Vizuete
 

Viewers also liked (14)

2 razmondial
2 razmondial2 razmondial
2 razmondial
 
Flying The Kites
Flying The KitesFlying The Kites
Flying The Kites
 
Reporte de afiches y promociones kerly
Reporte de afiches y promociones kerlyReporte de afiches y promociones kerly
Reporte de afiches y promociones kerly
 
Ch. 15 notes
Ch. 15 notesCh. 15 notes
Ch. 15 notes
 
I-COMference'12_Geisherik
I-COMference'12_GeisherikI-COMference'12_Geisherik
I-COMference'12_Geisherik
 
I-COMference'12_Serikova
I-COMference'12_SerikovaI-COMference'12_Serikova
I-COMference'12_Serikova
 
Munteanu murgoci georg, popa-burcă ion - românia şi ţările locuite de români
Munteanu murgoci georg, popa-burcă ion - românia şi ţările locuite de româniMunteanu murgoci georg, popa-burcă ion - românia şi ţările locuite de români
Munteanu murgoci georg, popa-burcă ion - românia şi ţările locuite de români
 
Glossario sistema ilfisco_
Glossario sistema ilfisco_Glossario sistema ilfisco_
Glossario sistema ilfisco_
 
Vac Pac and Reynolon
Vac Pac and ReynolonVac Pac and Reynolon
Vac Pac and Reynolon
 
Suresh &amp; Theory U
Suresh &amp; Theory USuresh &amp; Theory U
Suresh &amp; Theory U
 
planificacion 5 ef
planificacion 5 efplanificacion 5 ef
planificacion 5 ef
 
planificaciones Guia ef
planificaciones Guia efplanificaciones Guia ef
planificaciones Guia ef
 
planificaciones
planificacionesplanificaciones
planificaciones
 
Web 2.0
Web 2.0Web 2.0
Web 2.0
 

Similar to Html col tag jf (20)

Table and Form HTML&CSS
Table and Form HTML&CSSTable and Form HTML&CSS
Table and Form HTML&CSS
 
Html tables
Html tablesHtml tables
Html tables
 
Html3
Html3Html3
Html3
 
Html3
Html3Html3
Html3
 
v4-html-table-210321161424.pptx
v4-html-table-210321161424.pptxv4-html-table-210321161424.pptx
v4-html-table-210321161424.pptx
 
HTML Tables
HTML TablesHTML Tables
HTML Tables
 
uptu web technology unit 2 html
uptu web technology unit 2 htmluptu web technology unit 2 html
uptu web technology unit 2 html
 
html-table
html-tablehtml-table
html-table
 
HTML TABLES
HTML TABLESHTML TABLES
HTML TABLES
 
HTML (Hyper Text Markup Language) by Mukesh
HTML (Hyper Text Markup Language) by MukeshHTML (Hyper Text Markup Language) by Mukesh
HTML (Hyper Text Markup Language) by Mukesh
 
Web topic 12 tables in html
Web topic 12  tables in htmlWeb topic 12  tables in html
Web topic 12 tables in html
 
Html tables
Html tablesHtml tables
Html tables
 
Css tables
Css tablesCss tables
Css tables
 
table html web programing
table  html  web programingtable  html  web programing
table html web programing
 
Html
HtmlHtml
Html
 
Lecture-4.pptx
Lecture-4.pptxLecture-4.pptx
Lecture-4.pptx
 
Css
CssCss
Css
 
Html
HtmlHtml
Html
 
HTML Tables.ppt
HTML Tables.pptHTML Tables.ppt
HTML Tables.ppt
 
htmltables-180721142906-1.pptx
htmltables-180721142906-1.pptxhtmltables-180721142906-1.pptx
htmltables-180721142906-1.pptx
 

Html col tag jf

  • 1. HTML <col> Tag Also known as the “column” tag
  • 2. <col> • Definition: defines attribute values for one or more columns in a table – Must be used inside a <table> or a <colgroup> element
  • 3. <col> • <col> sets properties for a column of table cells, such as this table – Column = vertical region
  • 4. Placement • <col> tag goes – after the <table> tag – before any <tr> (table row), <thead> (table head), or <tbody> (table body) elements • May go inside <colgroup> element, but doesn’t have to
  • 5. Example usage and result <table border="1"> <colgroup> <col span="2" style="background-color:red" /> <col style="background-color:yellow" /> </colgroup> <tr> <th>ISBN</th> <th>Title</th> <th>Price</th> </tr> <tr> <td>3476896</td> <td>My first HTML</td> <td>$53</td> </tr> <tr> <td>5869207</td> <td>My first CSS</td> <td>$49</td> </tr> </table>
  • 6. <col> • Required attributes? – NONE • Optional attributes? – align – char – charoff – span – valign – width
  • 7. <col> Attribute values • span – number (of columns) the <col> element should span • for example <col span=“2”>
  • 8. <col> Attribute values • align – text alignment inside column • left, right, center, justify, char <col align=“center”>
  • 9. <col> Attribute values • width (fixes the width of the column) – % – pixels – relative_length • for example (pixels)… <col width=“100”>
  • 10. In conclusion… • Important! • <col> does NOT create columns – it sets the properties for the columns to be defined LATER IN THAT CODE