Tuesday, 26 November 2013

CSS Colors and Font Sizes

Let us take small steps and then create complex pages.

The font sizes can be altered using the font-size attribute. The font-size attribute can be defined in various forms. The simplest is using pixels in short px.

Here is an example showcasing the font-size using px.


1:  <?xml version = "1.0" encoding="utf-8"?>   
2:  <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">   
3:  <html xmlns = "http://www.w3.org/1999/xhtml">   
4:  <head>  
5:  <title>CSS Styling</title>  
6:  </head>  
7:  <body>  
8:  <p class="red">  
9:  Red  
10:  </p>  
11:  <p class="blue">  
12:  Blue  
13:  </p>  
14:  <p class="green">  
15:  Green  
16:  </p>  
17:  <style>  
18:  p.red  
19:  {  
20:  color:red;  
21:  font-size:20px;  
22:  }  
23:  p.blue  
24:  {  
25:  color:blue;  
26:  font-size:40px;  
27:  }  
28:  p.green  
29:  {  
30:  color:green;  
31:  font-size:60px;  
32:  }  
33:  </body>  
34:  </html>  
Post a Comment