liveBook · Manning

Font-size property

As explained in Build a Website with ChatGPT

The CSS font-size property specifies the size of text rendered by an element.

The CSS font-size property sets the size of text rendered by an element. A type size is the relative size of each character, commonly written in pixels using px. Regular page text defaults to 16px, though 20px may feel more comfortable to read. section 3.2.3

font-size: size;

Use font-size followed by a size value and a semicolon in a CSS rule. section 3.2.3

Make text larger

To set text to 20 pixels, use `font-size: 20px;`. Change only the number when adjusting the size, and keep the px unit in place. If text feels cramped or hard to read, try increasing its size by a pixel or two. section 3.2.3 section 4.4

Font sizes help distinguish the parts of a page. A typical page can use a larger title, smaller second-level headings, and regular body text. Default sizes include 32px for an h1, 24px for an h2, about 18.2px for an h3, and 16px for normal text, but you can choose sizes that better fit the design. section 3.2.7

When requesting generated CSS, specify sizes separately for the page parts that need different emphasis:

Size also works with page width and spacing. Larger text may call for a wider page, while smaller text can fit a narrower one. For more accessible sizing, convert pixel measurements to rem: by default, 1rem equals 16px, so 20px is 1.25rem, 24px is 1.5rem, 32px is 2rem, and 48px is 3rem. A rem size is relative to the default font size a browser user has chosen. section 4.4 section 5.4

For reusable styling, target a class rather than changing every paragraph individually. For example, `.entry-text { font-size: 20px; }` makes text in elements with the `entry-text` class larger. section 5.4

Choose font sizes deliberately in a page prompt, then fine-tune the generated CSS by changing the numeric values. This gives titles, headings, summaries, and body text a clear visual hierarchy without changing the page content. section 3.5 section 5.2.3

How Build a Website with ChatGPT covers it

How deep it goes
Defines pixel-based sizing, gives common heading values, and introduces rem conversion without deeper CSS mechanics.
Examples
Shows `font-size: 20px;`, heading defaults, a tagline request for 24px, and an `.entry-text` class rule.
What it assumes
Teaches sizing from a simple CSS declaration while supporting readers who ask ChatGPT to generate HTML and CSS.
What you can do after
Apply it via CSS by setting and adjusting pixel or rem text sizes for page elements.
How it connects
Connects font-size with CSS, headings, typefaces, colors, max-width, padding, margins, and rem units.

Also explained in

Compare how 9 books explain font-size property →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Build a Website with ChatGPT. The section links point to the parts of the book it draws on.