ITclub

العودة إلى Web Development
محاضرة 6

Comprehensive Review and Advanced HTML/CSS Techniques

مراجعة شاملة: تنسيق الجداول المتقدم (colspan/rowspan)، الطرق الثلاث لـ CSS، والخصائص العامة (Global Attributes).

ملخص المحاضرة

Lecture 6: Comprehensive Review and Advanced HTML/CSS Techniques

This lecture serves as a review of the core concepts, diving deeper into advanced table formatting, alternative ways to apply CSS (inline, internal, external), and essential global HTML attributes, consolidating knowledge for effective web development.

1. Advanced Table Formatting

The basic table structure (<table>, <tr>, <th>, <td>) can be enhanced for complex data layouts using attributes:

  • colspan: Specifies the number of columns a cell should span horizontally.
  • rowspan: Specifies the number of rows a cell should span vertically.
  • align and valign (Deprecated in HTML5, use CSS): Traditionally used to set horizontal (align: left, center, right) and vertical (valign: top, middle, bottom) alignment of cell content.

2. Global HTML Attributes (Review)

Global attributes can be used on almost any HTML element to provide extra control or information:

  • class: Assigns one or more class names for CSS styling or JavaScript manipulation. (Targeted by CSS: .classname)
  • id: Assigns a unique identifier to an element. (Targeted by CSS: #idvalue)
  • style: Used to apply Inline CSS directly to an element.
  • title: Provides extra information about an element, typically displayed as a tooltip on mouse hover.

3. CSS Application Structure (Three Ways)

A critical skill in web development is managing CSS rules using the three methods:

  1. Inline CSS: Using the style attribute (e.g., <h1 style="color: blue;">). Highest precedence, often used for dynamic or one-off styles.
  2. Internal CSS: Using the <style> tag in the <head> (e.g., <style> h1 { color: blue; } </style>). Applies to the current document.
  3. External CSS: Using a <link> tag to a separate .css file (e.g., <link rel="stylesheet" href="styles.css">). Best practice for project-wide styling and maintainability.

4. Dimensions and Box Control

Controlling the size and shape of elements is fundamental:

  • Dimensions: The height and width CSS properties explicitly set the size of the element's content area.
  • Border Radius: The border-radius CSS property is used to round the corners of an element's box (e.g., border-radius: 10px;).

5. Summary of Form Input Types

A thorough understanding of input types is necessary for form creation:

HTML Tag / AttributePurpose
<input type="text">Single-line text input.
<input type="password">Text obscured (dots/stars) for secure input.
<input type="radio">Select one option from a set (grouped by name).
<input type="checkbox">Select zero or more options.
<input type="file">Select a file for upload.
required AttributeMakes an input field mandatory for submission.