HTML style 属性,规定元素的行内样式

 2022-07-02    605  

HTML style 属性

HTML 全局属性

HTML style 属性,规定元素的行内样式

实例

在 HTML 文档中使用style 属性:

<h1 style="color:blue;text-align:center">这是一个标题</h1>
<p style="color:green">这是一个段落。</p>

定义和用法

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

style 属性将覆盖任何全局的样式设定,例如在 <style> 标签或在外部样式表中规定的样式。

HTML 4.01 与 HTML5之间的差异

在 HTML5 中, style 属性可用于任何的 HTML 元素 (它会验证任何HTML元素。但不一定是有用)。

在 HTML 4.01中, style 属性不能用于: <base>, <head>, <html>, <meta>, <param>, <script>, <style>, 和 <title>。

语法

<element style="style_definitions">

属性值

描述
style_definitions一个或多个由分号分隔的 CSS   属性和值。 (例如: style="color:blue;text-align:center")


  •  标签:  
  • html
  •  

原文链接:https://77isp.com/post/1705.html

=========================================

https://77isp.com/ 为 “云服务器技术网” 唯一官方服务平台,请勿相信其他任何渠道。