css基础

css全称:Cascading Style Sheets

中文名称:层叠样式表,级联样式表

Html

1.内嵌<head lang="en">

<h1 style="color=red;">我使用的内嵌的写法加入css样式</h1>

2.内联:写在title下面

<style>

h2{

color:deepskyblue;background:yellow

}

</style>

3.外联:

<link rel="stylesheet" href="global.css"/>

css基础语法:

选择器,以及一条或多条声明

语法规则:

选择器{

每条声明(属性:属性值)

}

权重:

  内嵌 id class 元素
  a b c d
内嵌                                  "style" 1 0 0 0
id                                        "#"  0 1 0 0
class、属性、伪类                  "." 0 0 1 0
元素,伪元素 0 0 0 1
通配符*        
!impotent 最高      

块级元素(block)有宽高:input,select,textarea,form,body,tyml,h,p,ul,ol,dl,dt,pre,blockquote,li,img,div

行内元素(inline)宽高不可设置:lable,span,head,q,a,strong,b,em,i

原文地址:https://www.cnblogs.com/ccotk/p/7107563.html