HTML可以使用CSS的一些基本的格式,语句格式如下:
<tagname style="property:value;">
property是 CSS 属性。value是 CSS 值。

背景颜色 background-color
CSS background-color
属性定义 HTML 元素的背景颜色。
例如:
<body style="background-color:powderblue;">
<h1>This is a heading</h1>
<p>This is a paragraph.</p>
</body>

又例如:
<body>
<h1 style="background-color:powderblue;">This is a heading</h1>
<p style="background-color:tomato;">This is a paragraph.</p>
</body>

文字颜色 color
CSS color
属性定义 HTML 元素的文字颜色。
例如
<h1 style="color:blue;">This is a heading</h1>
<p style="color:red;">This is a paragraph.</p>

字体 font-family
CSS font-family
属性定义 HTML 元素的字体。
例如:
<h1 style="font-family:verdana;">This is a heading</h1>
<p style="font-family:courier;">This is a paragraph.</p>

字体大小 font-size
CSS font-size
属性定义 HTML 元素的字体大小。
例如:
<h1 style="font-size:300%;">This is a heading</h1>
<p style="font-size:160%;">This is a paragraph.</p>

文字对齐 text-align
CSS text-align
属性定义 HTML 元素的水平文字对齐。
例如:
<h1 style="font-size:300%;">This is a heading</h1>
<p style="font-size:160%;">This is a paragraph.</p>

HTML可以对字体进行一些调整。
字体加粗 <b>和<strong>
HTML <b>
元素定义了粗体文字。这个标签没有重要性。
例如:
<b>This text is bold</b>

也可以使用<strong>
,这个标签有重要性。
例如:
<strong>This text is important!</strong>
<b>This text is bold</b>
字体斜体 <i>和<em>
HTML<i>
元素定义了斜体文字,常用来表示专业术语、其他语言的短语、思想、船名等。
例如:
<i>This text is italic</i>

也可以用HTML<em>
元素,一般表示重要的强调的东西(演讲者演讲的时候看到会加重音)
例如:
<em>This text is emphasized</em>
小字体 <small>
HTML <small>
元素定义了较小的字体。
例如:
<small>This is some smaller text.</small>

字体高亮 <mark>
HTML <mark>
元素定义了应高亮显示的文字。
例如:
<p>Do not forget to buy <mark>milk</mark> today.</p>

字体删除线 <del>
HTML <del>
元素定义删除的文字。浏览器通常会在删除的文字上划一条线。
例如:
<p>My favorite color is <del>blue</del> red.</p>

字体下划线 <ins>
HTML <ins>
元素定义插入文档的文字。浏览器通常会在插入的文字下划线。
例如:
<p>My favorite color is <del>blue</del> <ins>red</ins>.</p>

字体下标 <sub>
HTML <sub>
元素定义了下标文字。下标文字在正常行下显示半个字符,有时字体较小。下标文本可用于化学公式。
例如:
<p>This is <sub>subscripted</sub> text.</p>

字体上标 <sup>
HTML <sup>
元素定义了上标文字。上标文字比正常行高出半个字符,有时字体较小。上标文本可用于脚注。
例如:
<p>This is <sup>superscripted</sup> text.</p>

网友评论