css笔记

1.font:字体连写

 

选择器{font:font-style font-weight font-size/line-height font-family;}

 

使用font属性时,必须按照上面的语法格式书写,不能更换顺序,各个属性以空格隔开。

注意:其中不需要设置的属性可以省略(取默认值),但必须保留font-size和font-family属性,否则font属性不起作用。

 

 

2.id选择器和class选择器的区别

class可以多次重复使用

ID只能使用一次

 

3.<style>

div,p,span{

color: red;

}

</style>

 

4.行内块

img imput td

 

5.a

a里面可以放块级元素

 

 

6.顶线 中线 基线 底线

基线和基线之间的距离为行高

 

 

7.盒子 (上距离 内容 下距离)

 

 

8.行高等于height高度 垂直居中

行高大于height高度 位置偏下

行高小于height高度 位置偏上

 

 

9.

* 0000

div 0010

# 0100

行内 1000

! important

 

 

权重会叠加

 

 

 

10.background-position后面跟方位名词,顺序部分

如果只写一个值,另外一个默认居中

 

 

11.背景连写

 

background:背景颜色,背景图片,背景平铺,背景滚动,背景位置

 

12.居中

margin:0 auto;

左边和右边auto

 

13.清除内外边距

*{margin:0;padding:0;}

 

 

14嵌套元素的垂直外边距容易发生外边距塌陷

 

15.overflow:hidden

 

 

16.浮动可以使多个div并列显示

 

17.解决图片底下3px的问题

 

vertical-align:middle;

display:block;

 

18.文本省略

white-space: nowrap;

text-overflow: ellipsis;

overflow: hidden;

 

19.

@font-face{

font-family:'icomoon';

src:url('icomoon.eot');

src:url('font/icomoon.eot?#iefix') format('embedded-opentype'),

url('font/icomoon.woff') format('woff'),

url('font/icomoon.ttf') format('truetype'),

url('font/icomoon.svg#SofiaProLight') format('svg');

font-weight:normal;

font-style:normal;

 

}

 

 

原文地址:https://www.cnblogs.com/Yanss/p/10235913.html