CSC336-WT Lec4 Slides
CSC336-WT Lec4 Slides
HTML PROVIDES BASIC ELEMENTS FOCUS ON TABLES, DIV, AND SPAN THESE ELEMENTS HELP ORGANIZE
FOR STRUCTURING WEB CONTENT. FOR LAYOUT DESIGN. CONTENT WITHIN A WEBPAGE.
What Are HTML Tables?
Tables are used to present data in a Consist of rows and columns. Commonly used for structuring
tabular format. data, not for page layout (although
it was used for layout in the past).
Basic Table Structure
<table>
• html
•<thead>
Copy code
<tr>
• <table>
• <th>Header
<tr> 1</th> <th>Header 2</th>
• </tr><th>Header 1</th>
•</thead>
<th>Header 2</th>
•<tbody>
</tr>
• <tr>
<tr>
• <td>Data 1</td>
<td>Data <td>Data 2</td>
1</td>
• </tr><td>Data 2</td>
•</tbody>
</tr>
• </table>
</table>
• Example of a simple table with headers and data rows.
Table Elements
• <table>: Defines the table structure.
• <tr>: Table row.
• <td>: Table data (cell).
• <th>: Table header (bold and centered by default).
Using Tables for Layout (Deprecated)
In early web design, tables were This method is now discouraged in
Example:
used to structure entire web pages. favor of more flexible elements.
<table>
• html
<thead>
• Copy code
<tr>
• <table>
<th>Header</th>
</tr>
• <tr>
</thead>
• <td>Header</td>
<tbody>
• </tr>
<tr>
• <tr> <td>Content</td>
• <td>Content</td>
</tr>
</tbody>
• </tr>
<tfoot>
• <tr>
<tr>
• <td>Footer</td>
<td>Footer</td>
• </tr>
</tr>
</tfoot>
• </table>
</table>
Table Attributes
<div>
<h1>Title</h1>
<p>This is a paragraph inside a div.</p>
</div>
Div for Page Sections
• Example of a common webpage structure using <div>:
<div id="header">Header</div>
<div id="content">Main Content</div>
<div id="footer">Footer</div>
• Helps to create logical page divisions.
Introduction to Span
• <span>: An inline element used to group text for styling.
• Does not create a new block on the page.
• Best for styling small sections of text.
<p>This is a <span>highlighted</span>
word in a sentence.</p>