In this sample chapter from HTML and CSS: Visual QuickStart Guide, 9th Edition, author Joe Casabona looks at the most basic HTML elements, and how they can come together to create a well-formatted, readable, and meaningful page.
There’s a wide range of HTML elements, and technically all formatting of those elements happens in CSS. But certain HTML elements come with semantic meaning for how text should be presented on the screen.
In this chapter, we look at the most basic elements, and how they can come together to create a well-formatted, readable, and meaningful page.
HTML Text Formatting
If you’ve created text in Word or Google Docs, you’ll know that formatting can be done with the press of a few buttons. Select the text and choose a style from the menu, and formatting is applied. White space is added between paragraphs and headings, bullets are added to unordered lists, you can change the color of text, and more.
It’s not quite like that in HTML. If you just write text in an HTML document, there will be no formatting. All the text will run together, new lines will be ignored, and certain characters will not display properly.
While browsers do use a default style sheet to format all HTML elements, we still need to use HTML to describe every piece of content on the page. Without the HTML, the browser won’t know what kind of text is on the page.
So let’s start with the most common elements: headings and paragraphs.