一、HTML中的style属性:提供了一种改变所有HTML的元素样式的一种通用方法
设置了网页的背景颜色,一行文字的背景颜色,一个段落的背景颜色
<html>
<body style="background-color:yellow">
<h2 style="background-color:red">This is a heading</h2>
<p style="background-color:green">This is a paragraph.</p>
</body>
</html>
二、 字体,颜色和尺寸
font-family 设置字体
color 设置颜色
font-size 设置字体的大小
<html>
<body>
<h1 style="font-family:verdana">A heading</h1>
<p style="font-family:arial;color:red;font-size:20px;">A paragraph.</p>
</body>
</html>
三、文本对齐的方式
text-align 属性规定了元素中文本的水平对齐方式(中间不是下划线,是减号的位置)
<html>
<body>
<h1 style="text-align:center">This is a heading</h1>
<p style="text-align:left">上面的标题相对于页面居中对齐。</p>
</body>
</html>
left:左对齐
center:中间对齐
right:右对齐