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
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
相关文章推荐
- Web布局连载——两栏固定布局(五)
- easyui------显示隐藏列功能
- [div+css]晒晒最新制作专题推广页模板
- 盒子模型
- CSS选择器
- CSS样式优先权
- [css] line-height 百分比单位和数值单位的区别
- Apple官网研究之使用Justify布局导航
- 关于前端的思考与感悟
- 设计更快的网页(三):字体和 CSS 调整
- 纯CSS制作的新闻网站中的文章列表
- 10条影响CSS渲染速度的写法与使用建议第1/3页
- BS项目中的CSS架构_仅加载自己需要的CSS
- 很不错的 CSS Hack 又学了一招
- 发一个css比较清爽的写法
- CSS expression控制图片自动缩放效果代码[兼容 IE,Firefox]
- css布局网页水平居中常用方法
- CSS经典技巧十则第1/2页