用css来修饰页面文本

<html>
    <head>
        <title>修饰文本字体</title>
        <style type="text/css">
        h1{
            font-family:微软雅黑;            
        }
        p{
            font-family:隶书;
        }
        </style>
    </head>
    <body>
        <h1>2008中国经济发展形式</h1>
        <p>从宏观上来讲司法考试垃圾发生的经费卢卡斯飞洒</p>
    </body>
</html>

 

 

如果不确定浏览器中的字体,可以在指定的字体后面加备用字
Font-family:“全新硬笔行书简”,宋体;

 

文本段落行高: 可以使用line-height进行行高的设定。 其数值可以通过单位px,em和百分比来设定。
1em和100%都表示正常的行距。


禁止文本自动换行:
大部分互联网的页面都是禁止页面内容自动换行。
通过white-space属性可以禁止文本自动换行。
<style type="text/css">
P{
White-space:nowrap; //nowrap属性指定页面无法自动换行,而是出现滚动条。
}
</style>
当定义为white-space:pre时,其作用相当于<pre>标签。(保留空格换行什么的)

 

给页面对象添加颜色:
css中

Css其他关于文本和背景的属性:

 

举几个例子:

<style type="text/css">
Body{
    
    Background-image:url(图片/背景.png);
    Background-attachment:fixed;//设置页面背景图像放置的方式
    Font-size:1em;
    
}
P{
    Text-align:right;
}
.biaoti{
    Text-align:right;
    Color:#D35C0F;
    Font-size:2.5em;
    Font-weight:bold;
    Line-height:1.4em;
    Font-family:Cooper Std Black;
}
#date{
    Text-align:right;
    Color:#999999;
    Font-size:.8em;
    Font-weight:bold;
    Font-family:幼圆;
    White-space:pre;
}
a:link{
    Color:#6d2542;
    Text-decoration:none                //通过伪类修改页面的链接状态
}
a:visited{
    Color:#999999;
    Text-decoration:none;
}
a:hover{
    Color:#999999;
    Text-decoration:underline;
}
a:active{
    Color:#999999;
    Text-decoration:none
}
</style>

 

posted @ 2017-11-28 20:19  汪神  阅读(620)  评论(0编辑  收藏  举报