dmz社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

查看: 736|回复: 0

[Html/Css] css常用样式font控制字体的多种变换

[复制链接]
  • TA的每日心情

    2024-2-20 11:15
  • 签到天数: 11 天

    [LV.3]偶尔看看II

    878

    主题

    4343

    帖子

    3995

    积分

    终身会员[A]

    Rank: 7Rank: 7Rank: 7

    积分
    3995

    发表于 2020-3-23 20:00:00 | 显示全部楼层 |阅读模式

    本站资源全部免费,回复即可查看下载地址!

    您需要 登录 才可以下载或查看,没有帐号?立即注册

    x
    CSS 字体属性定义文本的字体系列、大小、加粗、风格(如斜体)和变形(如小型大写字母)font-family控制字体,由于各个电脑系统安装的字体不尽相同,但是基本装有黑体、宋体与微软雅黑这三款字体,通常这样写font-family:"黑体", "宋体","Microsoft YaHei"
    font-size控制字体大小,我们设置字体大小是设置它的宽度,它的高度一般电脑系统默认字体大小是16px,所以字体大小尽量不要低于16px,1em=16px; font-weight: bold;/*控制字重 一般是100-900 常用lighter(细体) normal(正常)bold加粗 */至于这个font-style,一般默认是normal,也就是正常的,如果说你设置 font-style: italic;斜体话,其实和这个<em></em>的效果是差不多的;文字间的间距用的line-height如果和高度相等话,就是垂直居中了。
    通常font字体的简写:font:style weight size/line-heigt font-family  /*要求必须出现的2个是 size与font-family*/



    [HTML] 纯文本查看 复制代码
    <!DOCTYPE html>
    <html lang="en">
    <head>
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <title>css常用样式font字体的多种变换</title>
        <style>
            div{
                font-family: 'Microsoft YaHei';/*微软雅黑*/
                /* font-family: 'Lucida Sans','Lucida Sans Regular', 'Lucida Grande', 'Lucida Sans Unicode', Geneva, Verdana, sans-serif; */
                /*字体加上双引号或者单引号,当有多个字体的时候,中间逗号分开*/
                color:#f90;
                font-size: 24px;/*控制字体大小*/
                font-weight: bold;/*控制字重 常用lighter(细体) normal(正常)bold加粗 */
                font-style: italic;/*等同于em*/
                line-height: 30px;
            }
            /*font字体的简写:font:style weight size/line-heigt font-family*/
            /*要求必须出现的2个是 size font-family*/
            p{  
                font: 24px/1.5em 'Lucida Sans','Lucida Sans Regular', 'Lucida Grande', 'Lucida Sans Unicode', Geneva, Verdana, sans-serif;
                letter-spacing: 1px;/*英文字母间距*/
                word-spacing: 10px;/*英文单词间距*/
            }
            P::first-letter{
                text-transform: capitalize;
            }/*第一个字母::first-letter*/
            p::first-line{
                color:red;
            }/*第一行::first-line*/
        </style>
    </head>
    <body>
        <div>技术为王世界,欲问青天山顶景色是否独好技术为王世界,欲问青天山顶景色是否独好技术为王世界,欲问青天山顶景色是否独好技术为王世界,
            欲问青天山顶景色是否独好技术为王世界,欲问青天山顶景色是否独好技术为王世界,欲问青天山顶景色是否独好技术为王世界,
            欲问青天山顶景色是否独好技术为王世界,欲问青天山顶景色是否独好 </div>
        <p>Technology is king world, I want to ask if the scenery on the top of Qingtian Mountain is the king of technology, 
            I want to ask whether the scenery of Qingtian Peak is the king of technology. If the technology is the king of the world, 
            I would like to ask whether the scenery on the top of Qingtian Mountain is the king of the world. Is the scenery good?</p>
    </body>
    </html>



    关于样式继承问题/*与文字有关样式会被继承下去*/代码展示如下:


    [HTML] 纯文本查看 复制代码
    <!doctype html>
    <html lang="en">
    <head>
        <meta charset="UTF-8">
        <title>index</title>
        <style>
            p{
                font-size: 20px;
                font-family: 微软雅黑;    
                color:#f00;
                font-weight:bold;
                font-style:italic;
                word-spacing:15px;
            }
    
        </style>
    </head>
    <body>
        <div>
            <p><span>linux php linux</span></p>
            <p><span>linux linux php linux</span></p>
            <p><span>linux linux php linux</span></p>
            <p><span>linux linux php linux</span></p>
        </div>    
    </body>
    </html>




    回复

    使用道具 举报

    您需要登录后才可以回帖 登录 | 立即注册

    本版积分规则

    QQ|Archiver|小黑屋|本站代理|dmz社区

    GMT+8, 2025-2-2 04:37 , Processed in 0.148382 second(s), 31 queries .

    Powered by Discuz! X3.4 Licensed

    Copyright © 2001-2021, Tencent Cloud.

    快速回复 返回顶部 返回列表