css基础-文字排版

1、字体

body{font-family:"宋体";}
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>认识html标签</title>
<style type="text/css">
body{font-family:"Microsoft Yahei";}
</style>
</head>
<body>
    <h1>勇气</h1>
    <p>三年级时,我还是一个<span id="stress">胆小如鼠</span>的小女孩,上课从来不敢回答老师提出的问题,生怕回答错了老师会批评我。就一直没有这个勇气来回答老师提出的问题。学校举办的活动我也没勇气参加。</p>

</body>
</html>
2、文字颜色、大小

body{font-size:12px;color:#666;}

3、粗体

p span{font-weight:bold;}
4、斜体

p a{font-style:italic;}
5、下划线

p a{text-decoration:underline;}
6、删除线

.oldPrice{text-decoration:line-through;}
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>删除样式</title>
<style type="text/css">
.oldPrice{text-decoration:line-through;}
</style>
</head>
<body>
<p>原价:<span class="oldPrice">300</span>元 现价:230 元</p> 
</body>
</html>

7、缩进

p{text-indent:2em;}   /*2em为文字两倍大小*/
8、行间距

p{line-height:1.5em;}
9、字间距、字母间距

h1{
    letter-spacing:50px;
}
h1{
    word-spacing:50px;   /*设置英文间距*/
}

10、块状居中对齐(也可居左或居右)

h1{
    text-align:center;
}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值