css基础知识

css层叠样式表,它是控制网页的格式
    css的三种样式表:
    1外部样式表
    2内嵌样式表
    3内联样式表
1.外部样式表
    先在一个css文件内定义我们需要被定义的元素的格式
    然后在html中的head部分加入<link rel="stylesheet" href="名称.css"/>

2.内嵌样式表
    
    在html中的head部分进行定义
    
    先写出<style type="text/css">
    然后写出要定义的部分
    格式:定义部分 {样式}
3.内联样式表
    
    直接在html文档中定义
    格式:<td align="center">5</td>
4. css的选择器
    
    (1) 元素选择器:

td{
            color: #000066;
            text-align: center;
        }

      (2) 伪类选择器:  h1:hover{
            color: #000066;
        }
(3) class选择器:
          .n{
            text-align: right;
        }

       (4)Id选择器 :

 #name{
            color: #008000;
            background-size: 20px;
        }

(5)包含选择器:
        p em{
            color: #008000;
            font-size: 50px;
            text-align: center;
        }

(6)伪元素选择器   :
         p:first-line(段落首行)
         p:first-line(元素首字母)
                        
    *{}
        通配符选择器
4 css注释
    
    /*注释内容*/

原文地址:https://www.cnblogs.com/luofeng316148334/p/5002653.html