CSS基础

来源:互联网 发布:python内置函数 编辑:程序博客网 时间:2024/06/05 13:22
1. CSS(Cascading style sheet)层叠样式表 CSS是对HTML的补充 CSS实现了网页内容和页面效果的分离
2. 有三种方式可以将样式表加入到HTML文档中
   1)内联样式表 2)嵌入样式表 3)外部样式表link
3. 样式规则选择器(通过怎样的途径来获得页面上要设置样式的元素)
   1)HTML Selector  2)class selector  3)ID selector  4)关联选择器  5)组合选择器 
   6)伪元素选择器
   伪元素选择器是指对同一个HTML元素的各种状态和其所包括的部分内容的一种定义方式
   例如,对于超链接标签<a></a>的正常状态、访问过的状态、选中状态、光标移到超链接文本上的状态
   以及对于段落的首字母和首行,都可以使用伪元素选择器来定义
   目前常用的伪元素有以下几种:
   A:active  A:hover  A:link  A:visited  P:first-line  P:first-letter
4. CSS当中的样式属性
   CSS当中的属性非常多,大体上可分为以下几类:字体、背景、文本、位置、布局、边缘、列表
   1)字体
   字体属性主要包括文字的字体、大小、颜色、显示效果等基本样式
   Font-family  Font-size  Font-style  Font-decoration  Font-weight    
   2)背景
   背景包括背景颜色、背景图像以及背景图像的控制
   Background-color  Background-image(repeat repeat-x repeat-y)  Background-attachment(fixed scroll)
   Background-position 
   3)文本
   文本的属性包括:文字间距、对齐方式、上标、下标、排列方式、首行缩进
   Word-spacing  Letter-spacing  Text-align(left right center)  Text-indent(第一行文本的缩进值)
   Line-height  
   4)位置
   文档流
   位置属性就是制定元素的位置
   Position(absolute relative static)  Left  Top  Width  Height  Z-indent
   5)边缘(盒子模型)
   margin用于设置元素的边界与其他元素的空隙大小
   margin-top  margin-right  margin-bottom  margin-left  margin
   padding-top  padding-right  padding-bottom  padding-left  padding
  
   Width属性用于设置元素边框的宽度 (thin medium thick)
   Border-top-width  Border-right-width  Border-left-width  Border-bottom-width  Border-width
  
   Color属性设置元素边框的颜色
   Border-top-color  Border-left-color  Border-bottom-color  Border-right-color  Border-color
  
   Style属性用于设置元素边框的样式 (none dotted dashed solid double )
   6)布局
   Display(inline block none)
   7)列表
   无序列表
   有序列表
   自定义列表
  
  
  
0 0