Web Development

CSS – Font Attribute & Example

CSS Font Attribute

Font-family – sequence of font family name separated by comma Font-style – normal , italic or oblique Font-weight – normal , bold, bolder, lighter or one of the nine numerical values (100,200,300,400,500,600,700,800,900)

Font-size – denotes absolute size (xx-small, x-small, small, medium, larger, x-larger, ss- large), relative size (larger, smaller), a number (of pixel), percentage (of the parent element’s size)

CSS Code

<style type = 'text/css'>
Hi {font-family: Arial, Helvetica}
P {font:size = 12 pt; font-style : italic}
</style>

HTML / CSS Code

<html>
 <head>
  <style type='text/css'>
   p{
    font-family:Courier,Trebuchet,Verdana;
    font-size:12pt;
    font-style:italc;
   }
  </style>
 </head>
 <body>
  <p> Hello World How are You Hello World How are You Hello World How are You Hello World How are You Hello World How are You</p>
 </body>
</html>

Output

Hello World How are You Hello World How are You Hello World How are You Hello World How are You Hello World How are You
Font-familyIt specifies the font to be used
Font-sizeIt specifies the size of the font used.
Font-styleIt specifies whether the font should be normal, italic or oblique.
Font-weightIt specifies whether the font should be normal, bolder, or lighter.

Tuts

About Author

Tutsmaster.org provides tutorials related to tech and programmings. We are also setting up a community for the users and students.

You may also like

HTML introduction
Web Development

HTML – Introduction, History & Syntax

  • December 21, 2019
So, first of all, I would like to ask a question for the first time when you heard this term
html heading tag
Web Development

HTML – Heading Tag With Syntax

  • December 21, 2019
A heading tag is one of the most important tags we focus on in HTML or web development because, without