CSS 字体

<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8">
        <title></title>
        <link rel="stylesheet" type="text/css" href="css_font.css"/>
    </head>
    <body>
        <div id="">
            <p class="p1">
                this is p  THIS IS P
            </p>
            <p class="p2">
                This Is P
            </p>
        </div>
    </body>
</html>
.p1{
    /* 字体 */
    font-family: "times new roman";
    /* 斜体 */
    font-style: italic;
    /* 粗细 */
    font-weight: bold;
    /* 使用 vw 单位设置文本大小,它的意思是“视口宽度
    文本大小将遵循浏览器窗口的大小 */
    font-size: 10vm;
}
.p2{
    /* 小写字母都将转换为大写字母。
    但是,转换后的大写字母的字体大小小于文本中原始大写字母的字体大小。 */
    font-variant: small-caps;
    /* 1em 等于当前字体大小。浏览器中的默认文本大小为 16px。
    因此,默认大小 1em 为 16px。
    可以使用这个公式从像素到 em 来计算大小:pixels/16=em。 */
    font-size: 2.5em ;
}

 

posted @ 2022-03-03 20:51  lwx_R  阅读(19)  评论(0编辑  收藏  举报