Home > Article > Web Front-end > HTML specifies the attribute style of the element's inline style
Example
Use the style attribute in HTML documents:
<h1 style="color:blue; text-align:center">This is a header</h1> <p style="color:red">This is a paragraph.</p>
Definition and usage
The style attribute specifies the inline style of the element
## The #style attribute will override any global style settings, such as those specified in the c9ccee2e6ea535a969eb3f532ad9fe89 tag or in an external style sheet. SupportW3C: The "W3C" column indicates whether the attribute is defined in the W3C's HTML/XHTML recommendations.Firefox | Opera | Safari | W3C | |
YES | YES | YES | YES |
<element style="value">Attribute
Description | |
One or more CSS properties and values separated by semicolons. |
<span style="font-size: 12pt;"><html> <body style = " <h1 stye = "background-color:red>This is a Heading</h1> <p style = "background-color:green>This is a Paragraph</p> </body> </html></span>The style attribute is eliminated The old "bgcolor" attribute has been replaced. Use the style attribute to set color, font, and size
1 <html> 2 <body> 3 <h1 style = "font-family:verdana">A Heading</h1> 4 <p style = "font-family:arial;color:red;font-size:20px;">A Paragraph</p> 5 </body> 6 </html>The style attribute eliminates the old 240cb830ca84ebaabbd07850110b414d tag. The style attribute sets the way the text is aligned
1 <html> 2 <body> 3 <h1 style = "text-align:center;">A Heading</h1> 4 <p>The heading above is aligned to the center of the page</p> 5 </body> 6 </html>The style attribute eliminates the align attribute.
The above is the detailed content of HTML specifies the attribute style of the element's inline style. For more information, please follow other related articles on the PHP Chinese website!