一、css介绍
css全称是层叠样式层,用于网页的修饰
有三种引入方式:
1、外部链接式:使用link标签 其中herf指向css文件;
2、内部式:在html文件的style标签内编写css代码;
3、行内式:直接在标签style属性中编写css代码。
标签的基本属性:
name:名称属性;
id:id属性;
style:样式属性;
class:类属性。
二、四种基本选择器(必会)
1、知识点预览
2、知识点示例展示
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>基本选择器</title>
<style>
/*通配符选择器,使用所有的标签*/
*{
font-family: sans-serif;
padding: 10;
margin: 10;
background-color: antiquewhite;
}
/*标签选择器*/
div{
border: 4px solid red;
width: 300px;
height: 50px;
background-color: aqua;
}
p{
width: 600px;
height: 60px;
background-color: sienna;
}
/*类选择器*/
.P_1{
border: 3px solid green;
background-color: aliceblue;
width: 400px;
height: 30px;
}
/*id选择器*/
#p_2{
border: 5px solid yellow;
width: 500px;
background-color: rgb(72, 216, 132);
}
</style>
</head>
<body>
<div>1</div>
<div>2</div>
<div>3</div>
<p class="P_1" style="color: rgb(201, 21, 21);font-size: 25px;">p1</p>
<p id="p_2" align="center" style="font-size: 25px; color: aqua;">p2</p>
<p align="end" style="font-family: 'Times New Roman', Times, serif;font-size: 25px;color: aliceblue;">p3</p>
</body>
</html>
3、效果展示
通过改变背景 边框 字体等效果展示了四种基本选择器的应用方式
三、其他选择器
1、除了基本选择器外,还有一些其他选择器我们也经常会用到
a、",":逗号:表示并列 用于多个选择器同时设置
b、" ":空格:表示包含 用于设置选择器内部选择器
c、">":大于号:子选择器 设置选择器内部
2、界面展示
除此之外:
3、伪类选择器
:link 未访问的链接的状态
:visited 访问过后的状态
:hover 鼠标划过的状态
:active 鼠标按下时的状态
四、常用属性
1、文字属性 font
font-family:字体的类型;(多个类型之间用逗号隔开)
font-style:itaitc; 斜体
font-size:数字px; 字体大小
font-weight:数字px; 字体的粗细
color:颜色; 设置字体颜色
2、文本属性 text
常用:
text-align: center;文本居中 (居左 居右等)
text-decoration: underline;文本设置线 (下划线 上划线 中间删除线等)
感兴趣可以具体实验一下
五、盒子模型
1、知识点预览
2、实例展示
3、效果展示
六、display显示属性
1、知识点预览
2、实例展示
3、效果查看
七、定位
1、知识点展示
2、实例1
3、实例2
其中div3会一直粘在屏幕上 感兴趣的可以试试
八、浮动
1、基础知识点
2、实例
3、效果展示
浮动效果最好自己上手实验 一步一步去看代码效果有利于理解
九、弹性盒子
1、知识点预览
2、实例:
3、效果
十、动画效果
动画效果
十一、总结
我们不管学习什么知识都需要上手进行操作 ,只有在实际中操作, 遇到问题 ,解决问题,我们才能进步成长,也能收获阶段的满足和喜悦
十二、分享
详细代码文件:
链接:https://pan.baidu.com/s/1siATszoVsAu3uvpLcjE7kQ?pwd=1209
提取码:1209
或: