用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>

 

转载于:https://www.cnblogs.com/wangshen31/p/7911871.html

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值