Login
Your Email
Pasword
Home
Write
Trending
History
Liked
Earning

How to use HTML Styles?

Setting the style of an HTML element is done with the style attribute

Do you have similar website/ Product?
Show in this page just for only $2 (for a month)
Create an Ad
0/60
0/180

The HTML style attribute use the  following syntax
<tagname style="property:value;">
The property is a CSS property. 
The value is a CSS value.
Background Color
The background-color property defines the background color for an HTML element.
To set the background color use the following code:
<body style="background-color:green;">
<h1>Heading</h1>
<p>Paragraph .The web page is with green background</p>
</body>

Color of Text
The color property of HTML defines the text color for an element.
<h1 style="color:blue;">Heading</h1>
<p style="color:green;">The paragraph text is in green color </p>

Fonts
The font-family property defines the font to be used for an HTML element.
<h1 style="font-family:verdana;">Heading</h1>
<p style="font-family:courier;">paragraph aaaaaa bbbbb ccc</p>

Text Size
The font-size property defines the text size for an HTML element.
<h1 style="font-size:400%;">Heading</h1>
<p  style="font-size:200%;">This is a paragraph</p>


Text Alignment
The text-align property defines the horizontal text alignment for an HTML element.
<h1 style="text-align:center;">Heading in center</h1>
<p style="text-align:center;">This paragraph is in center.</p>
These syntax can be followed to apply simple styling on text and web page. 

CONTINUE READING
HTML
Styles
HTML Styling
Ayesha
Tech writer at newsandstory