zoukankan      html  css  js  c++  java
  • 用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>
  • 相关阅读:
    Linux目录管理常用指令
    生成器
    Python上的MVC和MVT理解,请求头,请求体,请求行的理解
    sellect、poll、epoll
    冒泡法排序
    (android / IOS)
    发现一个bug如何定位是前端还是后台问题?
    ANR----以及如何定位是前端问题还是后台问题?
    给你一个web端项目你如何展开测试?
    给你一个app你如何展开测试?
  • 原文地址:https://www.cnblogs.com/wangshen31/p/7911871.html
Copyright © 2011-2022 走看看