C-Sharp | Java | Python | Swift | GO | WPF | Ruby | Scala | F# | JavaScript | SQL | PHP | Angular | HTML
HTML <col> tagHTML <col> tag is used to specify common column properties for each column within <colgroup> element in an HTML table. The <col> tag is useful when it requires to apply common style rules for each column cell rather than applying individually. Syntax<col span=" " style=" "> Note: In HTML <col> tag does not require a closing tag but in XHTML it require a closing </col> tag.Following are some specifications about the HTML <col> tag
Example 1<!DOCTYPE html> <html> <head> <title>Col tag</title> </head> <body> <h2>Example of Col Tag</h2> <table border="1"> <colgroup> <col span="2" style="background-color: #7fffd4"> <col span="2" style="background-color: #98f5ff"> </colgroup> <tr> <th>Roll No.</th> <th>Name</th> <th>Maths</th> <th>Science</th> </tr> <tr> <td>1</td> <td>Avinash</td> <td>68</td> <td>54</td> </tr> <tr> <td>2</td> <td>Neha</td> <td>65</td> <td>61</td> </tr> <tr> <td>3</td> <td>Jenny</td> <td>55</td> <td>78</td> </tr> <tr> <td>4</td> <td>Vivek</td> <td>75</td> <td>52</td> </tr> </table> </body> </html> Output: Attribute:Tag-specific Attribute
Global AttributeHTML <col> tag supports all Global attributes in HTML. Event AttributeHTML <col> tag supports all event attributes in HTML. Supporting Browsers
|