- Get link
- X
- Other Apps
style Attribute
We can format the web page or document using HTML. CSS is a standard for styling web pages, but sill we can use HTML attributes to format he text,paragraphs or other elements.In HTML styles of elements can be set using style attribute. The style is HTML attribute but the value we specify in style is CSS property-value written in CSS style.
Syntax:
<tagname style="property:value;">
Here the tagname is the name of element like ,p ,h1 etc, style attribute then the CSS property and value. We write CSS property and value in ""(double quotes) to differentiate it from HTML code
You can write many properties in style attribute to be applied to element using a semicolon(;) separator.
<tagname style="property:value;">
Here the tagname is the name of element like ,p ,h1 etc, style attribute then the CSS property and value. We write CSS property and value in ""(double quotes) to differentiate it from HTML code
You can write many properties in style attribute to be applied to element using a semicolon(;) separator.
We'll discuss some examples as follows.
HTML Background color
You can change the color of background using the CSS background-color and value within any HTML tag using style attribute.
The example below illustrates this property:
Example:
<div style="background-color: pink;"> This text has a pink background .</div>
Result:
HTML Text color
You can change the color of text using this CSS color and value with any HTML tag.
The example below illustrates this property:
Example:
<div style="color: red;"> The text has red color .</div>
Result:
HTML Fonts
You can change the font of text using this CSS font-family and value with any HTML tag.
The example below illustrates this property:
Example:
<div style="font-family: Courier;"> The text is in "Courier" font .</div>
Comments
Post a Comment
If you have any doubt, ask here