HTML CSS
1. frameset[已淘汰]
<frameset rows="100px, *" border="1px" bordercolor="black" noresize>
<frame src="01-top.html">
<frameset cols="200px, *">
<frame src="01-left.html">
<frame src="01-right.html" name="show">
</frameset>>
</frameset>
2. CSS
2.1 什么是CSS
HTML 是网页的骨架
CSS 装饰
CSS层叠样式表
洗脸,水乳,隔离,粉底,眉毛,眼线,眼影,高光,睫毛,口红....
已经1个小时~~
2.2 CSS的三种引入方式
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>02-CSS引入方式</title>
<style>
.div1 {
width: 200px;
height: 200px;
background-color: hotpink;
}
</style>
<link rel="stylesheet" href="css/02.css">
</head>
<body>
<div style="width: 200px; height: 200px; background-color: lawngreen"></div>
<div class="div1"></div>
<div id="id1"></div>
</body>
</html>
2.3 CSS选择器【重点】
1. 标签选择器
选择修饰对应标签名CSS样式
2. 类选择器
约束同class属性的HTML标签
要求.className
例如
<p class="p1"></p>
.p1 {}
3. id选择器
约束指定id属性的HTML标签,并且ID属性不可以重复,具有唯一性
要求 #idName
例如
<div id="id1"></div>
#id1 {}
决定当前HTML标签CSS样式的权重
id选择器 > class选择器 > 标签选择器
4. 层级选择器
按照HTML标签的层关系约束
5. 并集选择器
不同的选择器,通过逗号分隔,同时修饰
6. 通配选择器
*
7. 伪类选择器
3. CSS属性
3.1 背景
background-image: url("img/羊肉串.png");
background-repeat: no-repeat;
background-position: 50px 100px;
background-attachment: scroll;
3.2 边框
width: 200px;
height: 200px;
background-color: red;
border: 5px dotted blue;
border-radius: 50px;
3.3 文本设置
width: 200px;
height: 200px;
background-color: red;
color: yellowgreen;
font-size: 32px;
font-family: 仿宋;
font-weight: bold;
font-style: italic;
text-decoration: line-through navy;
text-align: left;
text-indent: 2em;
line-height: 200px;
4. 盒子模型
4.1 盒子模型图例
4.2 内边距
元素对外的分界线是边框,内边距可以认为属于元素内部
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>08-盒子模型之padding</title>
<style>
#id1 {
width: 200px;
height: 200px;
background-color: tomato;
padding: 50px 100px 150px 200px;
}
</style>
</head>
<body>
<div id="id1"></div>
</body>
</html>
4.3 外边距
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>09-盒子模型之margin</title>
<style>
* {
margin: 0;
padding: 0;
}
div {
width: 200px;
height: 200px;
background-color: tomato;
margin: 100px 50px 150px 200px;
}
</style>
</head>
<body>
<div></div>
</body>
</html>