liveBook · Manning

Internal style

As explained in Web Design Playground, Second Edition

An internal style sheet is a collection of CSS style rules embedded in an HTML document, typically within a style element in the document head.

An internal style sheet is a collection of CSS rules placed inside a <style> element in an HTML document’s <head>. It keeps page styling in one place instead of attaching a style attribute to every element. section 7.3 section 7.2

Each internal style sheet is built from familiar CSS pieces:

  • A selector identifies the elements to style, such as dt or a class selector. section 7.3
  • A declaration block holds property-value pairs inside braces, with declarations separated by semicolons. section 7.3
  • One rule can style every matching element, so changing one value updates the page consistently. section 7.3

Style every definition term

This small page uses one rule to make every dt element larger and bold. The same rule formats Gaffer, Best Boy, and Grip without repeating style attributes. section 7.3

<style>
    dt {
        font-size: 18px;         #1
        font-weight: bold;       #1
    }                            #1
</style>

Browse the complete style element and its dt rule, then compare it with the matching HTML content. section 7.3

How Web Design Playground, Second Edition covers it

How deep it goes
Defines selectors, declaration blocks, and style rules, but defers advanced selector details and broader cascade behavior.
Examples
Uses a dt rule to format movie-job terms such as Gaffer, Best Boy, and Grip.
What it assumes
Assumes basic HTML elements and property-value pairs while teaching internal stylesheet syntax from its constituent parts.
What you can do after
Apply CSS by placing a style element in head and writing reusable selector-based rules.
How it connects
Connects CSS declarations with selectors, inline styles, external style sheets, inheritance, and the cascade.

Also explained in

Compare how 2 books explain internal style →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Web Design Playground, Second Edition. The section links point to the parts of the book it draws on.