CSS Font

How to set a font of a text.

<html> <head> <style type="text/css"> h3 {font-family: times} p {font-family: courier} p.text{font-family: sans-serif} </style> </head>

<body> <h3>This is text</h3> <p>This is a paragraph</p> <p class="text">This is a paragraph</p> </body>

</html>

 

How to set a paragraph font using the "caption" value.

<html> <body>

<p>This is a normal text</p> <p style="font: caption">This is a text with a "caption" font</p>

</body> </html>

How to set the size of a font.

<html> <head> <style type="text/css"> h1 {font-size: 90%} h2 {font-size: 80%} p {font-size: 100%} </style> </head>

<body> <h1>This is text 1</h1> <h2>This is text 2</h2> <p>This is a paragraph</p> </body>

</html>

How to set the style of a font.

<html> <head> <style type="text/css"> h1 {font-style: italic} h2 {font-style: normal} p {font-style: oblique} </style> </head>

<body> <h1>This is text 1</h1> <h2>This is text 2</h2> <p>This is a paragraph</p> </body>

</html>

How to set the boldness of a font.

<html> <head> <style type="text/css"> p.normal {font-weight: normal} p.thick {font-weight: bold} p.thicker {font-weight: 900} </style> </head>

<body> <p class="normal">This is a text</p>

<p class="thick">This is a text</p>

<p class="thicker">This is a text</p> </body>

</html>

Post Comment
Login to post comments