html-css总结

220 阅读2分钟

html-css总结

1.块级元素:

d—hi—pi—ul>lii—ol>lii—dl>dt>dd

2.行内块元素:

img—input—textarea

3.行内元素:

span—a—b—u—i—s—strong—ins—em—del

4.引入方式:

1.内嵌(课上小demo)

2.外链:link(工作中写项目)

3.行内:style="css属性"(配合js)

5.选择器:

1.标签

2.类

3.id

4.通配符

5.后代(空格)

6.子代(>)

7.交集(div.box)

8.并集(逗号)

9.伪类(hover)

6.伪元素:

1. ::after

2. ::before

7.结构伪类:

1. :nth-child()

2. :first-child

3. :last-child

8.优先级:如果一个标签用了多个选择器, 样式还冲突

继承 < * < 标签 < 类 < id < 行内 < !important

(行内个数, id个数, 类个数, 标签个数)不能进位

9.文字属性(可以继承):

1.font-size(字体大小)

2.font-weight(字体粗细)

3.font-style(倾斜):

normal(不倾斜)—italic(倾斜)

4.color(颜色)

5.font-family:字体

6.text-align(水平对齐方式)

1.left(左)

2.center(中)

3.right(右)

7.line-hight(行高/实现文字居中)

8.text-indent:2em(首行缩进)

9.text-decoration(清除)

1.none(无)

2.underline(下划线)

10.盒子属性(不能继承):

1.margin(外边距):

1.margin-top

2.margin-right

3.margin-bottom

4.margin-left

2.border:边框线

3.padding:内边距

4.background:背景

1.background-color(背景色)

2.background-image(背景图)

3.background-repeat(背景图平铺)

4.background-position(背景图位置)

5.background-size(背景图缩放)

5.float(浮动)

1.float-left(左浮动)

2.float-right(右浮动)

6.position(定位)

2.position-static(静态定位):

不定位,标准流

2.position-relative(相对定位):

1.参考自己改变位置

2.保留标签原有的显示模式

3.不脱标,占位

3.position-absolute(绝对定位):

1.参考已经定位的父级改变位置,如果没有这样的的父级,则以浏览器出口改变位置。

2.标签会具有行内块元素特点

3.脱标

4.position-fixed(固定定位)

1.参考浏览器窗口改变位置(可以让标签不随着网页的滚动而变化)

2.标签会具有行内块元素特点

3.脱标

注意: 如果left和right同时设置会left生效, top和bottom同时设置会top生效

11.项目目录结构:

1.图片:

images(固定存在,logo)

uploads(上传产品图)

2.样式:

CSS{base.css}清除默认样式

{common.css}各个页面相同的部分的样式表

3.index.html

\