Search⌘ K
AI Features

How It Works: Formatting Our HTML Page

Explore how to format HTML pages by applying CSS styles directly within HTML tags. Learn key properties like font-family for fonts, background and font colors, and margin settings. This lesson helps you understand styling fundamentals to make your web pages visually organized and consistent.

How it works

Let’s go over the key lines of code in detail together:

HTML
<!DOCTYPE html>
<html>
<head>
<title>Table of Contents</title>
</head>
<body style="font-family: Verdana, Arial, sans-serif">
<h1 style="color: white; background-color:#61b3e7 ">
Introduction
</h1>
<p style="margin-left: 40px; margin-top: 80px;">
We'll create more content later...
</p>
<p style="margin-left: 40px;">
Live coding works!
</p>
</body>
</html>

Line 6: The style attribute in <body> defines the font type to be used with the font-family property. The property value is set to Verdana, Arial, sans-serif and as a result, the browser tries using the Verdana font first. If that is not found, it falls back to Arial, and in the worst-case assuming that even ...