CSS基础1-基础语法/选择器

一个例子

<!DOCTYPE html>
<html>
<head>
    <title></title>
    <meta charset="utf-8">
    <style type="text/css">
        
        /*类选择器*/
        .demo{
            font-size: 30px;
            color: blue;
        }

    </style>
</head>
<body>

    <h1>CSS层叠样式表</h1>

    <span class="demo">显示样式</span>
    <br>
    <span class="">显示样式</span>

</body>
</html>

引入css方式

行内就是在标签里面使用style,不要这样写,很复杂,没有显示和内容分离,要写很多代码

内部/嵌入样式,就是在同一个页面内,head里面写css,一般是调试的时候这样写

外部样式:css.css,放在head之间引入

<link rel="stylesheet" type="text/css" href="">

导入式

    <style type="text/css">
        
        @import "css.css"

        

    </style>

 

    <style type="text/css">
        


        /*类选择器*/
        .demo{
            font-size: 30px;
            color: blue;
        }

        .demo{
            font-size: 30px;
            color: red;
        }

    </style>

猜你喜欢

转载自www.cnblogs.com/weizhibin1996/p/9350213.html