好久没更新了
@@ -186,5 +186,13 @@ overflow-x:auto(滚动条)/ hidden (隐藏) 横向内容溢出的表现
|
||||
|
||||
overflow-y:auto(滚动条)/ hidden (隐藏) 纵向内容溢出的表现
|
||||
|
||||
|
||||
verticle-align 设置元素的垂直对齐方式
|
||||
属性值:
|
||||
* baseline 默认值,元素放置在父元素的基线上
|
||||
* text-top 元素顶端和父元素字体顶端对齐
|
||||
* text-bottom 元素顶端和父元素字体底部对齐
|
||||
* middle 元素位于父元素的中部
|
||||
...
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -115,7 +115,7 @@ css 盒模型包括如下要素
|
||||
width:300px;
|
||||
height:300px;
|
||||
background-color:red;
|
||||
margin-top:20px;
|
||||
margin-bottom:20px;
|
||||
}
|
||||
|
||||
#inner {
|
||||
|
||||
BIN
csspress/4.flex.assets/image-20210222165013291.png
Normal file
|
After Width: | Height: | Size: 67 KiB |
@@ -7,16 +7,9 @@ flex 意为弹性盒子,用来为盒模型提供最大的灵活性
|
||||
任何一个元素都能被指定为flex 容器
|
||||
|
||||
```
|
||||
/*
|
||||
选中元素为块级元素时
|
||||
*/
|
||||
display:flex
|
||||
display:flex 选中元素为块级元素时
|
||||
|
||||
|
||||
/*
|
||||
选中元素为内联元素时
|
||||
*/
|
||||
display:inline-flex
|
||||
display:inline-flex 选中元素为内联元素时
|
||||
```
|
||||
|
||||
### 基本概念
|
||||
@@ -35,13 +28,24 @@ display:inline-flex
|
||||
|
||||
当 flex-direction 的值为column时 主轴为竖直 侧轴为水平
|
||||
|
||||

|
||||

|
||||
|
||||
|
||||
|
||||

|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### 容器的属性
|
||||
|
||||
- flex-direction 声明容器使用的轴是水平的还是垂直的
|
||||
- row 水平
|
||||
- column 垂直
|
||||
- row 水平(起点在左)
|
||||
- column 垂直 (起点在上)
|
||||
- row-reverse 水平(起点在右)
|
||||
- column-reverse 垂直(起点在下)
|
||||
|
||||
- justify-content 声明排列的方式
|
||||
- center 居中
|
||||
- space-around 每个项目两侧的间隔相等 项目到边框有间距
|
||||
@@ -53,7 +57,7 @@ display:inline-flex
|
||||
- baseline 第一行文字的基线对齐
|
||||
- stretch 默认占满整个容器的高度
|
||||
|
||||

|
||||

|
||||
|
||||
```
|
||||
<!DOCTYPE html>
|
||||
@@ -103,7 +107,7 @@ display:inline-flex
|
||||
|
||||
##### center: 水平居中
|
||||
|
||||

|
||||

|
||||
|
||||
```
|
||||
.box{
|
||||
@@ -120,7 +124,7 @@ display:inline-flex
|
||||
|
||||
##### space-around 每个项目两侧的间隔相等 项目到边框有间距
|
||||
|
||||

|
||||

|
||||
|
||||
```
|
||||
.box{
|
||||
@@ -137,7 +141,7 @@ display:inline-flex
|
||||
|
||||
##### space-between 两端对齐 项目之间的间隔都相等
|
||||
|
||||

|
||||

|
||||
|
||||
|
||||
|
||||
|
||||
@@ -75,6 +75,50 @@
|
||||
|
||||
通过’%‘单位来实现响应式效果。浏览器高度和宽度发生变化时,通过百分比单位可以使元素的高和宽随着浏览器的变化而变化,从而实现响应式效果
|
||||
|
||||
可以取百分比的属性:
|
||||
* 定位:top, right, bottom, left
|
||||
* 盒模型:width,height, margin,padding
|
||||
* 背景:backgroug-position, backgroud-size
|
||||
* 文本:text-indent
|
||||
* 字体:font-size
|
||||
|
||||
css 百分比都相对于谁?
|
||||
结论:css的布局块都是盒子,然后一个盒子的百分比其实是相对于其包含块的,也就是他的父级元素。
|
||||
* 相对于父级宽度的:
|
||||
* width
|
||||
* max-width
|
||||
* min-width
|
||||
* padding
|
||||
* margin
|
||||
* text-indent
|
||||
* left
|
||||
* right
|
||||
...
|
||||
|
||||
* 相对于父级高度的:
|
||||
* height
|
||||
* max-height
|
||||
* min-height
|
||||
* top
|
||||
* bottom
|
||||
|
||||
* 相对于主轴长度(在flex弹性盒子布局中)
|
||||
* flex-basis
|
||||
|
||||
* 相对于继承字号的
|
||||
* font-size
|
||||
|
||||
* 相对于自身字号的
|
||||
* line-height
|
||||
|
||||
* 相对于自身宽高的
|
||||
* border-radius 等border相关
|
||||
* background-size
|
||||
...
|
||||
|
||||
* 相对于行高的
|
||||
* verticle-align (设置元素垂直对齐方式)
|
||||
|
||||
示例:
|
||||
|
||||
```
|
||||
@@ -195,5 +239,8 @@ rem是一个相对单位,1rem等于html元素上字体设置的大小。我们
|
||||
|
||||
2.根据设计稿大小,调整里面的最后两个参数值。
|
||||
|
||||
3.使用1rem=100px转换你的设计稿的像素,例如设计稿上某个块是100px*300px,换算成rem则为1rem*3rem。
|
||||
3.使用1rem=100px转换你的设计稿的像素,例如设计稿上某个块是100px * 300px,换算成rem则为1rem*3rem。
|
||||
|
||||
示例参考demo/rem.html
|
||||
|
||||
|
||||
|
||||
BIN
csspress/css实战(一).assets/image-20210223151126809.png
Normal file
|
After Width: | Height: | Size: 294 KiB |
BIN
csspress/css实战(一).assets/image-20210223174608465.png
Normal file
|
After Width: | Height: | Size: 375 KiB |
BIN
csspress/css实战(一).assets/image-20210223180430143.png
Normal file
|
After Width: | Height: | Size: 373 KiB |
BIN
csspress/css实战(一).assets/image-20210223180523455.png
Normal file
|
After Width: | Height: | Size: 1.0 MiB |
BIN
csspress/css实战(一).assets/image-20210223181949796.png
Normal file
|
After Width: | Height: | Size: 1.1 MiB |
BIN
csspress/css实战(一).assets/image-20210223182049992.png
Normal file
|
After Width: | Height: | Size: 355 KiB |
BIN
csspress/css实战(一).assets/image-20210223182258454.png
Normal file
|
After Width: | Height: | Size: 333 KiB |
BIN
csspress/css实战(一).assets/image-20210223182345438.png
Normal file
|
After Width: | Height: | Size: 270 KiB |
BIN
csspress/css实战(一).assets/image-20210223182428924.png
Normal file
|
After Width: | Height: | Size: 142 KiB |
BIN
csspress/css实战(一).assets/image-20210223182524394.png
Normal file
|
After Width: | Height: | Size: 495 KiB |
43
csspress/css实战(一).md
Normal file
@@ -0,0 +1,43 @@
|
||||
# css实战阶段一
|
||||
### 苏宁易购
|
||||
|
||||
#### 顶部导航栏:
|
||||
|
||||
.assets\image-20210223180523455.png)
|
||||
|
||||
|
||||
|
||||
说明: 写完顶部导航条以后需要加上下面的白色下拉框的内容 本阶段可以一直显示
|
||||
|
||||
### 白色的标题搜索栏
|
||||
|
||||
.assets\image-20210223181949796.png)
|
||||
|
||||
|
||||
|
||||
### 分类
|
||||
|
||||
.assets\image-20210223182049992.png)
|
||||
|
||||
|
||||
|
||||
### 热卖爆款
|
||||
|
||||
.assets\image-20210223182258454.png)
|
||||
|
||||
|
||||
### 冰箱洗衣机
|
||||
|
||||
.assets\image-20210223182345438.png)
|
||||
|
||||
|
||||
|
||||
### 底部导航
|
||||
|
||||
.assets\image-20210223182428924.png)
|
||||
|
||||
|
||||
|
||||
### 固定的侧边栏
|
||||
|
||||
.assets\image-20210223182524394.png)
|
||||
52
csspress/demo/absolute.html
Normal file
@@ -0,0 +1,52 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Document</title>
|
||||
<style>
|
||||
* {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
div {
|
||||
width: 60px;
|
||||
height: 60px;
|
||||
}
|
||||
|
||||
.box1 {
|
||||
width: 200px;
|
||||
height: 200px;
|
||||
background: yellow;
|
||||
margin: 20px;
|
||||
/* position:static */
|
||||
position: absolute;
|
||||
}
|
||||
|
||||
.box2 {
|
||||
background: red;
|
||||
position: absolute;
|
||||
top: 0px;
|
||||
left: 0px;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div class="box1">
|
||||
<div class="box2"></div>
|
||||
</div>
|
||||
<p>
|
||||
<p> 注:这里红色的div是依据 body定位的,而不是根据父元素黄色的div 定位,</p>
|
||||
<p> 加上position static 后也是根据body 定位,</p>
|
||||
<p>当父元素的Position声明为 absolute 时,红色会依据父级黄色定位,但是会超脱文档流,影响下面的元素</p>
|
||||
|
||||
|
||||
|
||||
|
||||
</p>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
46
csspress/demo/fixed.html
Normal file
@@ -0,0 +1,46 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Document</title>
|
||||
<style>
|
||||
* {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
body{
|
||||
overflow: auto;
|
||||
}
|
||||
.box1 {
|
||||
background: yellow;
|
||||
position: sticky;
|
||||
top: 0;
|
||||
width: 100%;
|
||||
/* height: 50px; */
|
||||
}
|
||||
|
||||
.box2 {
|
||||
height: 20px;
|
||||
position: fixed;
|
||||
top: 30px;
|
||||
width: 100%;
|
||||
background: red;
|
||||
}
|
||||
.box3{
|
||||
width: 60px;
|
||||
height: 900px;
|
||||
background: pink;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div class="box1">暖暖</div>
|
||||
<div class="box2"></div>
|
||||
<div class="box3"></div>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
@@ -1,57 +1,107 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Document</title>
|
||||
<style>
|
||||
*{
|
||||
margin:0;
|
||||
padding:0;
|
||||
* {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
.box{
|
||||
|
||||
.box {
|
||||
width: 1000px;
|
||||
height: 500px;
|
||||
background: pink;
|
||||
display:flex;
|
||||
display: flex;
|
||||
/* 通过display:flex来把目标元素设置成flex布局 */
|
||||
flex-direction: row;
|
||||
/* align-items: center; */
|
||||
justify-content: space-between;
|
||||
/* flex-direction 属性决定主轴的方向,值为row的时候水平排列 起点在左 */
|
||||
}
|
||||
.box1{
|
||||
|
||||
.box1 {
|
||||
width: 1000px;
|
||||
height: 500px;
|
||||
background: gold;
|
||||
display:flex;
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
/*
|
||||
justify-content: space-between;
|
||||
justify-content: space-around;
|
||||
justify-content: space-center;
|
||||
*/
|
||||
display: flex;
|
||||
flex-direction: row-reverse;
|
||||
}
|
||||
.left,.left1{
|
||||
|
||||
.left,
|
||||
.left1 {
|
||||
width: 200px;
|
||||
height: 200px;
|
||||
background: red;
|
||||
}
|
||||
.right,.right1{
|
||||
|
||||
.right,
|
||||
.right1 {
|
||||
width: 200px;
|
||||
height: 200px;
|
||||
background: blue;
|
||||
}
|
||||
|
||||
.box3 {
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.box4 {
|
||||
flex-direction: column-reverse;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div class="box">
|
||||
<div class="box" style="margin-bottom: 15px;">
|
||||
|
||||
<div class="left"></div>
|
||||
<div class="right"></div>
|
||||
<div>
|
||||
这里是flex-direction:row的状况 即水平排列 起点在左侧
|
||||
</div>
|
||||
</div>
|
||||
<div class="box">
|
||||
<div class="left"></div>
|
||||
<div class="left"></div>
|
||||
<div class="left"></div>
|
||||
<div class="left"></div>
|
||||
<div class="left"></div>
|
||||
<div class="left"></div>
|
||||
<div class="right"></div>
|
||||
<div>
|
||||
这里是flex-direction:row的状况 即水平排列 起点在左侧
|
||||
对于溢出的状况,flex-wrap 可以定义是否换行
|
||||
<P>默认属性值为 nowrap 不换行;其他属性还有wrap(换行), wrap-reverse(换行,第二行反向排列)</P>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="box1">
|
||||
<div class="left1"></div>
|
||||
|
||||
<div class="right1"></div>
|
||||
<div class="left1"></div>
|
||||
<div>
|
||||
这里是flex-direction:column的状况 即垂直排列 起点在上面
|
||||
</div>
|
||||
</div>
|
||||
<div class="box box3">
|
||||
<div class="left"></div>
|
||||
<div class="right"></div>
|
||||
<div>
|
||||
这里是flex-direction:column的状况 即垂直排列 起点在下面
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="box1 box4">
|
||||
|
||||
<div class="right1"></div>
|
||||
<div class="left1"></div>
|
||||
<div>
|
||||
这里是flex-direction:column-reverse的状况 即垂直排列 起点在下面
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
86
csspress/demo/flex1pailie.html
Normal file
@@ -0,0 +1,86 @@
|
||||
<!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: 1000px;
|
||||
height: 500px;
|
||||
background: pink;
|
||||
|
||||
display:flex;
|
||||
/* 通过display:flex来把目标元素设置成flex布局 */
|
||||
flex-direction: row;
|
||||
/* flex-direction 属性决定主轴的方向,值为row的时候水平排列 起点在左 */
|
||||
|
||||
justify-content: center;
|
||||
}
|
||||
.box1{
|
||||
width: 1000px;
|
||||
height: 500px;
|
||||
background: gold;
|
||||
display:flex;
|
||||
flex-direction: row;
|
||||
justify-content: space-between;
|
||||
|
||||
}
|
||||
.left,.left1{
|
||||
width: 200px;
|
||||
height: 200px;
|
||||
background: red;
|
||||
}
|
||||
.right,.right1{
|
||||
width: 200px;
|
||||
height: 200px;
|
||||
background: blue;
|
||||
}
|
||||
.box3{
|
||||
justify-content: space-around;
|
||||
}
|
||||
.box4{
|
||||
flex-direction: column-reverse;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div style="margin-bottom: 50px;">
|
||||
注:以下所有实例 基于flex-direction:row的情况,即水平排列 起点在左边
|
||||
</div>
|
||||
<div class="box">
|
||||
<div class="left"></div>
|
||||
<div class="right"></div>
|
||||
|
||||
</div>
|
||||
<div style=" margin-bottom: 30px;">
|
||||
上面是 justify-content:center 居中的状况
|
||||
</div>
|
||||
|
||||
<div class="box1">
|
||||
<div class="left"></div>
|
||||
<div class="right"></div>
|
||||
|
||||
</div>
|
||||
<div style=" margin-bottom: 30px;">
|
||||
上面是 justify-content:space-between 居中的状况
|
||||
两端对齐 项目之间的间隔都相等
|
||||
</div>
|
||||
|
||||
<div class="box box3">
|
||||
<div class="left"></div>
|
||||
<div class="right"></div>
|
||||
|
||||
</div>
|
||||
<div style=" margin-bottom: 30px;">
|
||||
上面是 justify-content:space-around 居中的状况
|
||||
每个项目两侧的间隔相等 项目到边框有间距
|
||||
即两端不对齐
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
112
csspress/demo/flexjiaochazhou.html
Normal file
@@ -0,0 +1,112 @@
|
||||
<!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: 1000px;
|
||||
height: 500px;
|
||||
background: pink;
|
||||
display:flex;
|
||||
/* 通过display:flex来把目标元素设置成flex布局 */
|
||||
flex-direction: row;
|
||||
/* flex-direction 属性决定主轴的方向,值为row的时候水平排列 起点在左 */
|
||||
|
||||
align-items: center;
|
||||
}
|
||||
.box1{
|
||||
width: 1000px;
|
||||
height: 500px;
|
||||
background: gold;
|
||||
display:flex;
|
||||
flex-direction: row;
|
||||
align-items: flex-start;
|
||||
|
||||
}
|
||||
.left,.left1{
|
||||
width: 200px;
|
||||
height: 200px;
|
||||
background: red;
|
||||
}
|
||||
.right,.right1{
|
||||
width: 200px;
|
||||
height: 200px;
|
||||
background: blue;
|
||||
}
|
||||
.box3{
|
||||
align-items: flex-end;
|
||||
}
|
||||
.box4{
|
||||
align-items: baseline ;
|
||||
}
|
||||
.box5{
|
||||
align-items: stretch;
|
||||
}
|
||||
.lefta{
|
||||
height:auto
|
||||
}
|
||||
.boxfin{
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div style="margin-bottom: 50px;">
|
||||
注:以下所有实例 基于flex-direction:row的情况,即水平排列 起点在左边
|
||||
且 主轴为默认
|
||||
</div>
|
||||
<div class="box">
|
||||
<div class="left"></div>
|
||||
<div class="right"></div>
|
||||
</div>
|
||||
<div style=" margin-bottom: 30px;">
|
||||
上面是 align-items:center 居中的状况
|
||||
</div>
|
||||
|
||||
<div class="box1">
|
||||
<div class="left"></div>
|
||||
<div class="right"></div>
|
||||
|
||||
</div>
|
||||
<div style=" margin-bottom: 30px;">
|
||||
上面是 align-items: flex-start; 起点在上面
|
||||
</div>
|
||||
|
||||
<div class="box box4">
|
||||
<div class="left"></div>
|
||||
<div class="right"></div>
|
||||
|
||||
</div>
|
||||
<div style=" margin-bottom: 30px;">
|
||||
上面是 align-items:base-line 项目的第一行文字的基线对齐的情况
|
||||
</div>
|
||||
|
||||
<div class="box1 box5">
|
||||
<div class="left lefta"></div>
|
||||
<div class="right lefta"></div>
|
||||
|
||||
</div>
|
||||
<div style=" margin-bottom: 30px;">
|
||||
上面是 align-items:stretch(默认值) 如果项目未设置高度或设为auto,将占满整个容器的高度。
|
||||
</div>
|
||||
|
||||
<div class="box1 boxfin">
|
||||
<div class="left"></div>
|
||||
<div class="right"></div>
|
||||
|
||||
</div>
|
||||
<div class="zong">
|
||||
总结1:flex-direction属性定义的是主轴方向,默认为水平,所以 交叉轴方向默认为垂直;
|
||||
<p>当 flex-direction的值为column的时候,align-items决定的就是垂直方向的排列方式</p>
|
||||
<b>align-items决定的是交叉轴的排列方式 而不一定是单指 垂直的排列方式</b>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,11 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Document</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
35
csspress/demo/relative.html
Normal file
@@ -0,0 +1,35 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Document</title>
|
||||
<style>
|
||||
* {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
div{
|
||||
width: 60px;
|
||||
height: 60px;
|
||||
}
|
||||
.box1 {
|
||||
background: yellow;
|
||||
}
|
||||
|
||||
.box2 {
|
||||
background: red;
|
||||
position: relative;
|
||||
top: 20px;
|
||||
left: 30px;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div class="box1">暖暖</div>
|
||||
<div class="box2"></div>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
@@ -38,6 +38,6 @@
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
媒体查询实现自适应
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,50 +1,35 @@
|
||||
<!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>
|
||||
<script>
|
||||
document.querySelectorAll
|
||||
</script>
|
||||
<style>
|
||||
*{
|
||||
margin:0px;
|
||||
margin:0;
|
||||
padding: 0;
|
||||
}
|
||||
html , body{
|
||||
width:100% ;
|
||||
html,
|
||||
body {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
.box{
|
||||
width: 100%;
|
||||
height: 60%;
|
||||
border: 1px solid black;
|
||||
}
|
||||
.content{
|
||||
width: 60px;
|
||||
height: 60px;
|
||||
width: 30%;
|
||||
height: 30%;
|
||||
background: pink;
|
||||
margin: 30px;
|
||||
}
|
||||
/* @media (max-width: 780px) {
|
||||
.box{
|
||||
width: 600px;
|
||||
}
|
||||
.content{
|
||||
background: skyblue;
|
||||
}
|
||||
}
|
||||
@media (max-width: 600px) {
|
||||
.box{
|
||||
width: 500px;
|
||||
}
|
||||
.content{
|
||||
background: rgb(135, 235, 202);
|
||||
}
|
||||
} */
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div class="box">
|
||||
<!-- <div class="content"></div> -->
|
||||
</div>
|
||||
百分比实现自适应
|
||||
<div class="box"></div>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
117
csspress/实战/xuechengzaixian.html
Normal file
@@ -0,0 +1,117 @@
|
||||
<!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;
|
||||
}
|
||||
.nav{
|
||||
width: 100%;
|
||||
height: 66px;
|
||||
vertical-align:middle;
|
||||
line-height: 66px;
|
||||
background: #f4f5f7;
|
||||
font-size: 13px;
|
||||
}
|
||||
.main{
|
||||
width: 938px;
|
||||
margin: 0 auto;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
}
|
||||
.left{
|
||||
display: flex;
|
||||
}
|
||||
.logo{
|
||||
width: 132px;
|
||||
height: 29px;
|
||||
background-color: aqua;
|
||||
margin: auto 0;
|
||||
margin-right: 20px;
|
||||
}
|
||||
.menu{
|
||||
list-style: none;
|
||||
display: inline-flex;
|
||||
}
|
||||
.menu li{
|
||||
margin-right: 27px;
|
||||
}
|
||||
.search{
|
||||
width: 180px;
|
||||
height: 28px;
|
||||
border-radius: 4px;
|
||||
outline: none;
|
||||
border: 0px;
|
||||
padding-left: 20px;
|
||||
margin-left: 1px;
|
||||
}
|
||||
.right{
|
||||
display: flex;
|
||||
}
|
||||
.msg{
|
||||
width: 10px;
|
||||
height: 20px;
|
||||
background: black;
|
||||
margin: auto 0;
|
||||
margin-left: 11px;
|
||||
margin-right: 11px;
|
||||
}
|
||||
.photo{
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
border-radius: 60%;
|
||||
background: white;
|
||||
margin: auto 0;
|
||||
margin-right: 11px;
|
||||
}
|
||||
.searchbox{
|
||||
background: #00a4ff;
|
||||
height: 32px;
|
||||
margin: auto 0;
|
||||
line-height:29px;
|
||||
margin-right:19px
|
||||
}
|
||||
.searchbox span{
|
||||
|
||||
color: white;
|
||||
padding:5px 19px;
|
||||
|
||||
}
|
||||
.icon{
|
||||
width: 10px;
|
||||
height: 10px;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="nav">
|
||||
<div class="main">
|
||||
<div class="left">
|
||||
|
||||
<img src="" alt="" class="logo">
|
||||
<ul class="menu">
|
||||
<li>首页</li>
|
||||
<li>课程</li>
|
||||
<li>职业规划</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="right">
|
||||
<div class="searchbox">
|
||||
<input type="text" placeholder="输入关键字" class="search">
|
||||
<span>搜索</span>
|
||||
</div>
|
||||
|
||||
<p>个人中心</p>
|
||||
<div class="msg"></div>
|
||||
<div class="photo"></div>
|
||||
<p>asd</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||