Text styling
<style>
body { font-family: system-ui, Arial, sans-serif; line-height: 1.6; }
h1 { font-size: 2.2rem; letter-spacing: -0.5px; }
p { color: #334155; text-align: justify; }
a { text-decoration: none; border-bottom: 2px solid #93c5fd; }
.upper { text-transform: uppercase; font-weight: 700; }
</style>
<h1>Typography</h1>
<p>Good typography makes long pages easy to read.</p>
<p class="upper">uppercase text</p>Key properties
font-familysets the typeface. Always add fallback fonts.font-sizesets size. Useremfor accessibility.font-weightsets boldness, from 100 to 900.line-heightsets space between lines. About 1.5 to 1.7 reads well.text-align,text-transform,letter-spacingandtext-decorationcontrol alignment and effects.
Web fonts
You can add fonts from a font service or host your own files with @font-face. Hosting yourself avoids extra third-party requests.
@font-face {
font-family: "MyFont";
src: url("myfont.woff2") format("woff2");
font-display: swap;
}Backgrounds
<style>
.hero {
padding: 60px 20px;
color: white;
text-align: center;
background: linear-gradient(135deg, #2563eb, #7c3aed);
border-radius: 16px;
}
</style>
<div class="hero"><h2>Gradient Background</h2></div>.banner {
background-image: url("banner.jpg");
background-size: cover;
background-position: center;
}Practice
Design a blog article page with a readable font size, comfortable line height, a gradient header and styled links.