您好,欢迎访问一九零五行业门户网

html规定元素的行内样式(inline style)的属性style

实例
在 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 的详细内容。
其它类似信息

推荐信息