Comments - Font-Weight Flashcards
CSS Comments
A CSS comment look like this:/* Comment goes here */ Example: p { color: green; /* This is a comment */ font-size: 150%; }
Three main sources of style information to form a cascade
- The stylesheet created by theauthor of the page
- Thebrowser’s default styles
- Styles specifiedby the user
Inheritance
Inheritance refers to the way properties flow through the page. A child element will usually take on the characteristics of the parent element unless otherwise defined.
For example:
body {
color: green;
font-family: Arial;
}
<p>
This is a text inside the paragraph.
</p>
Properties: font-family
The font-family property specifies the font for an element.
Two types of font family names
- font family: a specific font family (like Times New Roman or Arial)
- generic family: a group of font families with a similar look (like Serif or Monospace)
Generic font families include
Serif
Sans Serif
Monospace
Examples of font families include
Times New Roman Georgia Arial Verdana Courier New Lucida Console
Properties: Font-Size
The font-size property sets the size of a font. One way to set the size of fonts on the web is to usekeywords.For examplexx-small,small,medium,large,larger, etc.
Ex:
The CSS: p.small { font-size: small; } p.medium { font-size: medium; } p.large { font-size: large; } p.xlarge { font-size: x-large; }
Properties: Font-Style
The font-style property is typically used to specify italic text.
The HTML:<p class="italic">This is a paragraph in italic style.</p> The CSS: p.italic { font-style: italic; }
The three values of the font-style property
Normal
Italic
Oblique
Tag for italic font style
<i></i>
Properties: Font-weight
The font-weight controls the boldness or thickness of the text.
Values that can be set for the font-weight property
Normal
Bold
Bolder
Lighter
E.g.,
The HTML:<p class="light">This is a font with a "lighter" weight.</p><p class="bold">This is a font with a "bold" weight.</p><p class="bolder">This is a font with a "bolder" weight.</p> The CSS: p.light { font-weight: lighter; } p.bold { font-weight: bold; } p.bolder { font-weight: bolder; }
Another way to define the “font-weight” property
You can also define the font weight with a number from100(thin) to900(thick), according to how thick you want the text to be.
400 is the same as normal, and 700 is the same as bold.
The HTML:<p class="light">This is a font with a "lighter" weight.</p><p class="thick">This is a font with a "bold" weight.</p><p class="thicker">This is a font with a "700" weight.</p> The CSS: p.light { font-weight: lighter; } p.thick { font-weight: bold; } p.thicker { font-weight: 700; }