Html Style
Advertisements
Html Style
Every Html element has a default style. Default background color is white, text color is black, text-size is 16px . For changing these default style of an Html element, you need to use style attribute. Below example changes the default text color from black to red:.
Example
<html> <body> <p>This is my html page.</p> <p style="color:red;">Html is Simple and easy to learn.</p> </body> </html>
Result
This is my html page.
Html is Simple and easy to learn.
Style Attribute
Syntax
style="property:value"
- Text color: The color property defines the text color
- Text font: The font-family property defines the font
- Text size: The font-size property defines the text size
- Text alignment: The text-align property defines the horizontal text alignment
Example
<!DOCTYPE html> <html> <body> <h1 style="font-size:20px">This is a heading</h1> <p style="font-color:red">This is a paragraph.</p> <p style="font-family:courier">This is Second paragraph.</p> <p style="text-align:center">This is Third paragraph.</p> </body> </html>
Result
This is a heading
This is a paragraph.
This is Second paragraph.
This is Third paragraph.
Google Advertisment