CSS基础知识

1、创建

  a、外部样式表:<head><link rel="stylesheet" type="text/css" href="yourcssname.css"></head>

     浏览器会从href指向的文件读取样式声明

  b、内部样式表:当单个文档需要特殊的样式时使用,在<head>内用<style>body{...}...</style>定义

  c、内联样式:eg : <p style="color:red; margin-left:20px">这是一个段落</p>

   优先级从内到外

2、id 和 class

  a、 id eg:                                                                  b、class eg:

           

       注意:两者的名字都不能以数字开头

原文地址:https://www.cnblogs.com/wolun666/p/CSS.html