您的位置:首页 > Web前端

Web前端初步——小扎2

2016-04-20 19:36 435 查看
css文字排版

1、字体样式 font-family

在设置字体font-family时,不要设置非常用字体,因为如果用户本地电脑上如果没有安装你设置的字体,就会显示浏览器默认的字体。

body{font-family:"Microsoft Yahei";} or  body{font-family:"微软雅黑";}

2、字体大小 font-size:12px 颜色 color

3、字体加粗 font-weight:bold

4、斜体 font-style:italic

5、下划线 text-decoration:underline

6、删除线  text-decoration:line-through

注:设置删除线颜色的方法:由于还没提供专门的函数,这里采用折衷的方法:

<html>

<head>

<meta http-equiv="Content-Type" content="text/html; charset=gb2312">

<title>删除样式</title>

<style type="text/css">
.oldPrice{text-decoration:line-through;color:red}

.text{color:black;}

</style>

</head>

<body>
<p>原价:<span class="oldPrice"><span class="text">300</span></span>元 现价:230 元</p> 

</body>

</html>

7、缩进 text-indent::2em

8、行间距 line-height:2em

9、字或字母间距 letter-spacing:20px

10、单词间距 word-spacing:20px

11、居右|中|左 text-align:right|center|left
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息