NET W1 (IMPORTANT

Cards (17)

  • CREATING TABLES
    Creating Tables in HTML
    > Tables are used to neatly display information on a web page
    > Tables are also used to control web page layout (where we place text and mages on the page)
    > Tables can be useful when eating borders around images and text on your page
  • Table Parts
    Row - Horizontal line of data
    Header Cell - Contains text that describes the data in a row or column
    Data Cell - Contains data
  • Defining the table
    <table> tag - Simply defines that a table will exist No border or content are created
  • Creating a table border
    <table border="1"> -  Defines a border of 1 pixel width
  • Creating a table row
    <tr> tag - Used to create a new row 
                       No content created as yet
                       The tag does not need to be closed
  • Creating a header cell
    <th> tag - Used to create a header cell (describing other data)
    Does not need to be closed
    The content follows the cell's definition
  • Creating a data cell
    <td> tag - Used to create a data cell
    Does not need to be closed
    The content follows the cell's definition
  • A Few Points to Mention
    > The table would expand as much as necessary to accommodate the content (provided you have not specified a width for it)
    > By default, the header cell (<th> </th>) tags make the content placed in them bold and centred
    > By default, the data cell (<td> </td>) tags render the content placed in them aligned to the left
    > You can place any content you wish in the cells (images, lists, paragraphs, etc.)
  • Specifying the table's height
    <table height="100"> - Defines a height for the table, 100 pixels wide
  • Centring a table
    <center><table></table></center> - By default the table is left-aligned; centre it as follows
  • Aligning Data Horizontally
    <td align="left"> <td align="center"> <td align="right"> -  To align a data cell horizontally use the align attribute By default, the cell is aligned to the left
  • Aligning Data Vertically
    <td valign="top"> <td valign="middle"> <td valign="bottom"> - To align a data cell vertically use the valign attribute By default, the cell is aligned in the middle
  • Changing a row background
    <tr bgcolor="green"> - To change the colour of a row just use bgcolor attribute
  • Changing a cell background
    <td bgcolor="green"> - To change the colour of a cell just use bgcolor attribute
  • Changing a table background color
    <table bgcolor="green"> -  To change a table's background color use bgcolor attribute
  • Changing cell spacing
    <table cellspacing="10"> - You can change the amount of space between each cell
    Default spacing is 10 pixels
  • Changing cell padding
    <table cellpadding="10"> - You can change the amount of space around the contents of each cell; Default cell padding is 10 pixel