练习
This commit is contained in:
48
teaching/林锦绣/css.html
Normal file
48
teaching/林锦绣/css.html
Normal file
@@ -0,0 +1,48 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Document</title>
|
||||
<!--
|
||||
网页的结构由 html(决定网页的结构) css(决定网页的样式) js(决定网页的交互)
|
||||
css(层叠样式表)
|
||||
引入 行内 html标签中写一个style=""
|
||||
内联样式 html文件内 的head里面 写 style标签 在这里面写css属性
|
||||
外部样式 link rel=stylesheet
|
||||
|
||||
语法 选择器{
|
||||
属性:属性值;
|
||||
属性:属性值
|
||||
}
|
||||
|
||||
盒模型
|
||||
margin 吞并 发生在两个块级元素垂直方向 规律是 取数大的间距
|
||||
* 通配符 选中的是整个网页上的所有元素
|
||||
-->
|
||||
<style>
|
||||
*{
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
}
|
||||
.box{
|
||||
width: 200px;
|
||||
height: 200px;
|
||||
background: red;
|
||||
margin-bottom: 50px;
|
||||
}
|
||||
.box2{
|
||||
width: 200px;
|
||||
height: 200px;
|
||||
background: blue;
|
||||
margin-top: 20px;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<p style="color:red"></p>
|
||||
<div class="box"></div>
|
||||
<div class="box2"></div>
|
||||
</body>
|
||||
</html>
|
||||
36
teaching/林锦绣/flex.html
Normal file
36
teaching/林锦绣/flex.html
Normal file
@@ -0,0 +1,36 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Document</title>
|
||||
<style>
|
||||
*{
|
||||
margin:0;
|
||||
padding:0;
|
||||
}
|
||||
.box{
|
||||
height: 500px;
|
||||
border: 1px solid blue;
|
||||
display: flex;
|
||||
justify-content:space-between;
|
||||
/* align-items: baseline; */
|
||||
align-items: flex-end;
|
||||
}
|
||||
.item{
|
||||
width: 200px;
|
||||
height: 200px;
|
||||
background:red;
|
||||
line-height: 50px;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="box">
|
||||
<div class="item">aaaa</div>
|
||||
<div class="item"></div>
|
||||
<div class="item"></div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
69
teaching/林锦绣/float.html
Normal file
69
teaching/林锦绣/float.html
Normal file
@@ -0,0 +1,69 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Document</title>
|
||||
<style>
|
||||
*{
|
||||
margin:0;
|
||||
padding:0;
|
||||
}
|
||||
.box{
|
||||
width: 200px;
|
||||
height: 200px;
|
||||
background: red;
|
||||
float:left
|
||||
|
||||
}
|
||||
.box1{
|
||||
width:200px;
|
||||
height: 200px;
|
||||
background: blue;
|
||||
float:right
|
||||
}
|
||||
.box3{
|
||||
width:200px;
|
||||
height: 200px;
|
||||
background: pink;
|
||||
|
||||
/* clear: both; */
|
||||
}
|
||||
/*
|
||||
display: inline-block 水平排列( 既能设置宽高 又能实现水平排列 从左往右)
|
||||
float 水平排列
|
||||
float 既可以从左往右 又能从右往左
|
||||
|
||||
|
||||
|
||||
浮动元素能够和块级元素 重叠 但是不能跟行框盒子盒子
|
||||
float 造成的父元素高度塌陷的问题
|
||||
|
||||
想给谁清浮动就给谁加clear:both
|
||||
伪元素
|
||||
给加空盒子然后加clear:both;
|
||||
overflow 给父级元素加
|
||||
|
||||
|
||||
*/
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div style="overflow: auto;">
|
||||
<div class="box"></div>
|
||||
<div class="box1"></div>
|
||||
<!-- <p>
|
||||
float 水平排列
|
||||
float 既可以从左往右 又能从右往左 float 水平排列
|
||||
float 既可以从左往右 又能从右往左 float 水平排列
|
||||
float 既可以从左往右 又能从右往左 float 水平排列
|
||||
float 既可以从左往右 又能从右往左 float 水平排列
|
||||
float 既可以从左往右 又能从右往左 float 水平排列
|
||||
float 既可以从左往右 又能从右往左
|
||||
</p> -->
|
||||
|
||||
</div>
|
||||
<div class="box3"></div>
|
||||
</body>
|
||||
</html>
|
||||
58
teaching/林锦绣/position.html
Normal file
58
teaching/林锦绣/position.html
Normal file
@@ -0,0 +1,58 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Document</title>
|
||||
<!--
|
||||
内联元素 不换行 display inline
|
||||
块级元素 换行 display block
|
||||
定位 position
|
||||
默认值 是static
|
||||
relative 相对定位 相对于他自己
|
||||
absolute 绝对定位 如果说他的父元素被 relative修饰 那么他就是按照父元素进行定位 如果父元素不被relative 那么他按照最外层(body)进行定位
|
||||
fixed 固定定位
|
||||
sticky 粘性 滚动条不动的时候 元素是相对定位 滚动条滚动的时候 他是 固定定位
|
||||
|
||||
用法 position:relative
|
||||
top:30px
|
||||
left:
|
||||
bottom
|
||||
right
|
||||
|
||||
|
||||
-->
|
||||
<style>
|
||||
*{
|
||||
margin:0;
|
||||
padding: 0;
|
||||
}
|
||||
.box{
|
||||
width:400px;
|
||||
height: 400px;
|
||||
background: red;
|
||||
position: relative;
|
||||
margin: 0 auto;
|
||||
margin-top: 60px;
|
||||
}
|
||||
|
||||
.item{
|
||||
width: 200px;
|
||||
height: 200px;
|
||||
background-color: blue;
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="box">
|
||||
<div class="item"></div>
|
||||
</div>
|
||||
<div>
|
||||
<img src="" alt="">
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user