实例
在 HTML 文档中使用 style 属性:
<h1 style="color:blue; text-align:center">This is a header</h1> <p style="color:red">This is a paragraph.</p>
定义和用法
style 属性规定元素的行内样式(inline style)
style 属性将覆盖任何全局的样式设定,例如在 <style> 标签或在外部样式表中规定的样式。
支持
W3C: "W3C" 列指示 W3C 的 HTML/XHTML 推荐标准中是否定义了该属性。
IE Firefox Opera Safari W3C YES YES YES YES YES语法
<element style="value">
属性
值 描述 style_definition 一个或多个由分号分隔的 CSS 属性和值。以下是几个style属性的实例:
使用style属性改变背景颜色(bgcolor作用)
<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>
style属性淘汰了旧的"bgcolor"属性。
使用style属性设置颜色、字体和尺寸
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>
style属性淘汰了旧的<font>标签。
style属性设置文本对其方式
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>
style属性淘汰了align属性。
以上就是html规定元素的行内样式(inline style)的属性style 的详细内容,更多请关注Gxl网其它相关文章!
查看更多关于html规定元素的行内样式(inlinestyle)的属性style的详细内容...
声明:本文来自网络,不代表【好得很程序员自学网】立场,转载请注明出处:http://www.haodehen.cn/did72016