Episode 4.1
THE INVISIBLE RULES THAT STYLE THE WEB
Class 12 (10+2) • Unit 4: Elementary Server side Scripting through PHP
💡 Direct Stream: You can also watch directly on YouTube or via local server:
📺 Watch on YouTube.com
Episode code: 4.1
✍️ Episode 4.1 Topic Notes
📌 A. Inline Styles (Element-Level)
- Written directly inside an HTML tag using the
styleattribute. - *Example:*
<h1 style="color: red; font-size: 24px;">Welcome</h1> - *Pros:* Quick testing, highest specificity.
- *Cons:* Destroys separation of content and presentation; impossible to maintain across multiple pages.
📌 B. Internal / Embedded Style Sheets (Document-Level)
- Defined inside a
<style>block within the<head>section of a single HTML document. - *Example:*
- *Pros:* Ideal for single-page websites with unique styling.
- *Cons:* Code duplication across multi-page web applications.
📌 C. External Style Sheets (Site-Wide - Industry Standard)
- Written in a standalone plain text file with a
.cssextension (e.g.,styles.css) and linked in the HTML<head>using the<link>tag. - *Example:*
<link rel="stylesheet" type="text/css" href="styles.css"> - *Pros:* Industry standard! A single stylesheet controls thousands of pages. Browsers cache the external CSS file, dramatically accelerating page load times.
📌 A. The Cascade ("C" in CSS)
- The
!importantrule overrides all normal specificity calculations.
📌 C. Inheritance
- *Inherited properties:*
color,font-family,font-size,line-height,text-align. - *Non-inherited properties:*
margin,padding,border,width,height,background-color. - Color Formats:
- Color Names:
red,teal,navy.