91-9990449935 0120-4256464 |
CSS FontCSS Font property is used to control the look of texts. By the use of CSS font property you can change the text size, color, style and more. You have already studied how to make text bold or underlined. Here, you will also know how to resize your font using percentage.
These are some important font attributes:
1) CSS Font ColorCSS font color is a standalone attribute in CSS although it seems that it is a part of CSS fonts. It is used to change the color of the text. There are three different formats to define a color:
In the above example, we have defined all these formats. Test it NowOutput: This is heading 1This is heading 2This is a paragraph. 2) CSS Font FamilyCSS font family can be divided in two types:
Serif: Serif fonts include small lines at the end of characters. Example of serif: Times new roman, Georgia etc. Sans-serif: A sans-serif font doesn't include the small lines at the end of characters. Example of Sans-serif: Arial, Verdana etc. Test it NowOutput: This heading is shown in sans-serif.This heading is shown in serif.This paragraph is written in monospace. 3) CSS Font SizeCSS font size property is used to change the size of the font. These are the possible values that can be used to set the font size:
Output: This font size is extremely small. This font size is extra small This font size is small This font size is medium. This font size is large. This font size is extra large. This font size is extremely large. This font size is smaller. This font size is larger. This font size is set on 200%. This font size is 20 pixels. 4) CSS Font StyleCSS Font style property defines what type of font you want to display. It may be italic, oblique, or normal. Test it NowOutput: This heading is shown in italic font.This heading is shown in oblique font.This heading is shown in normal font.5) CSS Font VariantCSS font variant property specifies how to set font variant of an element. It may be normal and small-caps. Test it NowOutput: This heading is shown in normal font.This paragraph is shown in small font. 6) CSS Font WeightCSS font weight property defines the weight of the font and specify that how bold a font is. The possible values of font weight may be normal, bold, bolder, lighter or number (100, 200..... upto 900). Test it NowOutput: This font is bold. This font is bolder. This font is lighter. This font is 100 weight. This font is 200 weight. This font is 300 weight. This font is 400 weight. This font is 500 weight. This font is 600 weight. This font is 700 weight. This font is 800 weight. This font is 900 weight.
Next TopicCSS Line Height
|