Linggo, Disyembre 4, 2011

Tables, Frames & Division Tags

Tables HTML Tags <table>



The <table> tag defines an HTML table.
A simple HTML table consists of the table element and one or more trth, and td elements.
The tr element defines a table row, the th element defines a table header, and the td element defines a table cell.
A more complex HTML table may also include caption, col, colgroup, thead, tfoot, and tbody elements.

Attributes(optional):

  • align
  • bgcolor
  • border
  • cellpadding
  • cellspacing
  • rules
  • summary
  • width



Example

A simple HTML table, containing two columns and two rows:

<html><body bgcolor=cyan><br>
<center><h1><b>MY Table Example</b></h1></center><br>
<table border="5" align=center width="50%" height="50%"  >
  <tr>
    <th>Month</th>
    <th>Savings</th>
  </tr>
  <tr>
    <td align="center">January</td>
    <td align="center">$100</td>
  </tr>
   <tr>
    <td align="center">Febuary</td>
    <td align="center">$200</td>
   </tr>
</table>
</body></html>






Frames HTML Tags <Frame>



HTML Frames

With frames, you can display more than one HTML document in the same browser window. Each HTML document is called a frame, and each frame is independent of the others.
The disadvantages of using frames are:
  • Frames are not expected to be supported in future versions of HTML
  • Frames are difficult to use. (Printing the entire page is difficult).
  • The web developer must keep track of more HTML documents


The HTML frameset Element

The frameset element holds one or more frame elements. Each frame element can hold a separate document.
The frameset element states HOW MANY columns or rows there will be in the frameset, and HOW MUCH percentage/pixels of space will occupy each of them.



The HTML frame Element

The <frame> tag defines one particular window (frame) within a frameset.
In the example below we have a frameset with two columns.
The first column is set to 25% of the width of the browser window. The second column is set to 75% of the width of the browser window. The document "frame_a.htm" is put into the first column, and the document "frame_b.htm" is put into the second column:

<html>

<frameset cols="25%,75%">

   <frame src="div.html" />

   <frame src="table.html" />

</frameset>

</html>





Division Tags <div>

The <div> tag is nothing more than a container for other tags. Much like the body tag, Div elements are block elements and work behind the scenes grouping other tags together. Use only the following attributes with your div element, anything else should be reserved for CSS. (CSS Tutorial)


  • id
  • width
  • height
  • title
  • style
For the purpose of this example, we have included the style attribute in order to color our div tag in order to bring a stronger visualization for our viewers.

<html><body bgcolor="yellow">

<div id="menu" align="right" >
<a href="">HOME</a> | 
<a href="">CONTACT</a> | 
<a href="">ABOUT</a>
</div>

<div id="content" align="left" bgcolor="white">
<h3>Content Articles</h3>
<p>This paragraph would be your content
 paragraph with all of your readable material.</p>
</div>

</body>  
</html>





From: John Benedict Palado(3:30-5:30)