text-decoration: line-through puts a line through the text (“strike-through”). text-decoration: overline places a line above the text. text-decoration: underline, does what you would expect. Text-decoration states whether the text has got a line running under, over, or through it. It can be font-style: italic or font-style: normal. font-styleįont-style states whether the text is italic or not. Play around with these font-weight values if you want see their effect but, keep in mind, that some older browsers become a little confused with anything other than bold and normal so we suggest sticking to those unless you’re a typography ninja. Be careful with this - text such as headings should not just be an HTML paragraph ( p) in a large font - you should still use headings ( h1, h2 etc.) even though, in practice, you could make the font-size of a paragraph larger than that of a heading (not recommended for sensible people).įont-weight, font-style, font-variant, and text-transform. font-sizeįont-size sets the size of the font. You can use a wider selection than the “safe” fonts using several methods outlined in the CSS Advanced Tutorial but if you’re just getting to grips with CSS, we suggest sticking with this basic standard approach for the moment. Note: if the name of a font is more than one word, it should be put in quotation marks, such as font-family: "Times New Roman". So font-family: arial, helvetica, serif, will look for the Arial font first and, if the browser can’t find it, it will search for Helvetica, and then a common serif font.
This is useful because different computers sometimes have different fonts installed.
The purpose of this is that if the user does not have the first font you specify, the browser will go through the list until it finds one it does have. There are a select few “ safe” fonts (the most commonly used are Arial, Verdana and Times New Roman), but you can specify more than one font, separated by commas. The user’s browser has to be able to find the font you specify, which, in most cases, means it needs to be on their computer so there is little point in using obscure fonts that are only sitting on your computer.