CSS can be used to customize text. You can customize things like font-family, font-style and font-weight.
At the bottom of this page there is a code editor pre-loaded with the lesson's code.The font-family is the name of the font, like Helvetica or Arial. Helvetica and Arial are examples of
A generic family is a general group of fonts. You can name a generic font or additional fonts as back-up. The web browser will first try to display the first font listed. If that font can not be displayed, the browser will go to the next font listed. It is good to have a generic font-family listed by the end.
.myFont {
font-family: "Lucida Console", "Courier New", monospace;
}
.myFont
- This is our class name, used in HTML tags.{}
- Curly Brackets - The CSS code that defines myFont will be inside these.CSS Code
- - the font-family: "Lucida Console", "Courier New", monospace"Lucida Console"
- This is the font-family you really want! As long as the web browser is
able to display "Lucida Console", it will not look any futher."Courier New"
- This is your second choice. If there is a problem displaying "Lucida Console",
the browser will display text as "Courier NHew".monospace
- Just in case the browser has a problem with both "Lucida Console" and "Courier New", you
are letting it know to display text as something monospace. <span class = 'myFont'>So, say we all! </span>
Now, let's add a font-style to myFont.
.myFont {
font-family: "Lucida Console", "Courier New", monospace;
font-style: oblique;
}
➼ myFont
- This is the class name
➼ font-family
- Its "Lucida Console", "Courier New", monospace
➼ font-style
- Its oblique
<span class = 'myFont'>So, say we all!</span>
Font-weight describes the boldness of text. The higher the number, the bolder the text.
Now, let's add a font-weight to myFont.
.myFont {
font-family: "Lucida Console", "Courier New", monospace;
font-style: oblique;
font-weight:bold;
}
➼ myFont
- This is the class name
➼ font-family
- Its "Lucida Console", "Courier New", monospace
➼ font-style
- Its oblique
➼ font-weight
- Its bold
<span class = 'myFont'>So, say we all!</span>
Now, change the font size.
.myFont {
font-family: "Lucida Console", "Courier New", monospace;
font-style: oblique;
font-weight:bold;
color: #080838;
font-size:18px;
}
➼ myFont
- This is the class name
➼ font-family
- Its "Lucida Console", "Courier New", monospace
➼ font-style
- Its oblique
➼ font-weight
- Its bold
➼ color
- Its #080838, a dark blue
➼ font-size
- Its 18px
<span class = 'myFont'>So, say we all!</span>