Home > Web Front-end > CSS Tutorial > css font controls multiple transformations of fonts

css font controls multiple transformations of fonts

青灯夜游
Release: 2021-01-02 09:31:00
forward
2072 people have browsed it

css font controls multiple transformations of fonts

Tutorial recommendation: css video tutorial

CSS font properties define the font family, size, boldness, style (such as italics) and Deformed (such as small caps) font-family controls fonts. Since the fonts installed in each computer system are different, there are basically three fonts: Heibody, Songti, and Microsoft Yahei.

font-sizeControl the font size. When we set the font size, we set its width and height. Generally, the default font size of the computer system is 16px, so the font size should not be lower than 16px. 1em=16px;

font-weight: bold;/*The control font weight is generally 100-900. Commonly used lighter (fine body) normal (normal) bold bold*/

As for this font-style, the default is normal, which is normal. If you set font-style: italic; italic, it is actually the same as this The effect is almost the same; if the line-height used for the spacing between text is equal to the height, it will be vertically centered.

Usually the abbreviation of font font: font:style weight size/line-heigt font-family /*The two requirements that must appear are size and font-family*/

<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>css常用样式font字体的多种变换</title>
    <style>
        div{
            font-family: &#39;Microsoft YaHei&#39;;/*微软雅黑*/
            /* font-family: &#39;Lucida Sans&#39;,&#39;Lucida Sans Regular&#39;, 
            &#39;Lucida Grande&#39;, &#39;Lucida Sans Unicode&#39;, 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 &#39;Lucida Sans&#39;,&#39;Lucida Sans Regular&#39;,
             &#39;Lucida Grande&#39;, &#39;Lucida Sans Unicode&#39;, 
             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>
Copy after login

About style inheritance Question/*Styles related to text will be inherited*/The code is shown below:

<!doctype html>
<html>
<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>
Copy after login

For more programming-related knowledge, please visit: Programming Teaching! !

The above is the detailed content of css font controls multiple transformations of fonts. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:cnblogs.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template