19 Aug How to set/change font color in HTML
We can easily set font color in HTML using CSS styles i.e creating inline, internal and external CSS. The CSS color property is to be used for this purpose. Use it and set/ change the font color. Following is the correct way to use the property:
Inline CSS to set font color
1 2 3 |
<body style="color:blue"> |
Internal CSS to set background color
1 2 3 4 5 6 7 8 9 |
<head> <style> body { color: blue; } </style> </head> |
Example
Now, we will create a web page and set font color with all other elements essential for an HTML document:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
<!DOCTYPE html> <html> <head> <title>HTML Document</title> <style> body { background-color: blue; color: white; } </style> </head> <body> <h2>Online Book Store</h2> <p>Following books are available:</p> <ul> <li>Invisible Man</li> <li>Beloved</li> <li>The Great Gatsby</li> <li>The Grapes of Wrath</li> <li>Their eyes were watching God</li> </ul> </body> </html> |
No Comments