80 likes | 199 Vues
In this chapter, we explore how to select and format font families effectively in web design. Learn the importance of using standard fonts, specifying alternative fonts, and employing quotes for multi-word font names. Discover methods for setting bold and italic styles using CSS selectors and classes. Get guidance on font sizing with units or percentages, and how to manage indentations and paragraph alignments. Additionally, we cover text decoration options to enhance your website's aesthetic. Gain key insights into layering text styles for optimal results.
E N D
Formatting with Style Chapter 10
Choosing a Font Family • Multi-word fonts require quotes • Ex: p {font-family: “Times New Roman”} • Use “standard” fonts • Specify alternate fonts • Ex: p {font-family: Arial, Verdana}
Bold & Italic Fonts Method 1: Selectors p {font-style: italic; font-weight: bold} Method 2: Classes .emph {font-style: italic} .bolded {font-weight: bold} <span class=“emph”>text</span> <span class=“bolded”>text</span>
Font Size • Specify units or % (ex: 12px or 110%) • Use keywords: small, medium, large, x-small, xx-small, x-large, xx-large Method 1: Selectors p {font-size:12pt} Method 2: Classes .bodyfontsize {font-size:12pt} <body class=“bodyfontsize”>
Indentations Method 1: Selectors p {text-indent: 20px} Method 2: Classes .pindent {text-indent: 20px} <p class=“pindent”>
Aligning Text • Alignment can be left, center, right or justify Method 1: Selectors h1,h2 {text-align: center} Method 2: Classes .hcenter {text-align: center} <h1 class=“hcenter”>
Text Decoration • Common values: Blink, line-through, overline, underline, none Method 1: Selectors a:link {text-decoration: none} Method 2: Classes .nodecor {text-decoration: none} .stricken {text-decoration: line-through} <a href=“index.htm” class=“nodecor”> <span class=“stricken”>