HTML Style का इस्तेमाल मौजूदा HTML elements के style को बदलने या style add करने के लिये होता है|
Style aatribute किसी भी HTML tag के साथ इस्तेमाल किया जा सकता है| HTML tag पर style apply करने के लिये आपको css properties की मूल जानकारी होनी चाहिए जैसे कि color, background-color, text-align, font-family और font size आदि|
Style attribute का syntax नीचे दिया गया है|
- style= “property:value”
HTML Style color
Color property का इस्तेमाल text color को परिभाषित करने के लिये होता है|
css की color property से html tags styling का एक उदाहरण देखें:
- <h3 style=“color:green”>This is Green Color</h3>
- <h3 style=“color:red”>This is Red Color</h3>
Output
This is Green Color
This is Red Color
HTML Style background-color
background-color property का इस्तेमाल HTML tag के लिये background color को परिभाषित करने के लिये होता है|
css की background-color property से html tags styling का एक उदाहरण देखें:
- <h3 style=“background-color:yellow;”>This is yellow background</h3>
- <h3 style=“background-color:red;color:white”>This is red background</h3>