HTML style attribute

HTML style attribute and Syntax

HTML style attribute is used to apply different cascading designing effects on the particular tag.

Style Attribute Syntax: <tagname style="property:value;"> For Example: <p style="color:blue;"> Paragraph in Blue Color </p> Example of Style Attribute of a Tag. <html> <head> <title>HTML Style Attribute</title> </head> <body> <img src="image/nature.png" border="1" style="height:100px; width:100px;" /> <a style="color:green;" href="" > Google Search </a> <div style="height:200px; border:1px red solid;" ></div> </body> </html> The style properties can also be written in <style> tag and we can call these style properties through class. Class Always started with dot( . ) e.g .container Example of <style>Tag. <html> <head> <title>HTML Style Attribute Using Class</title> <style> .container{ background-color:gray; border:1px solid black; } </style> </head> <body> <div class="container"> I am a div ,Class container applied one me . </div> </body> </html>
Chapter Next »