Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
檀越@新空间
Coding Tree
提交
26059158
C
Coding Tree
项目概览
檀越@新空间
/
Coding Tree
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
C
Coding Tree
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
“235332544ce1aba6f2380e3209e79c8ff083e4d9”上不存在“paddle/git@gitcode.net:s920243400/PaddleDetection.git”
提交
26059158
编写于
1月 19, 2022
作者:
彭世瑜
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix
上级
829fa900
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
254 addition
and
0 deletion
+254
-0
blog/front-end-learn/css-float.md
blog/front-end-learn/css-float.md
+81
-0
blog/front-end-learn/css-product.md
blog/front-end-learn/css-product.md
+76
-0
blog/front-end-learn/demo/css-float-4.html
blog/front-end-learn/demo/css-float-4.html
+42
-0
blog/front-end-learn/demo/css-float-5.html
blog/front-end-learn/demo/css-float-5.html
+53
-0
blog/front-end-learn/index.md
blog/front-end-learn/index.md
+2
-0
未找到文件。
blog/front-end-learn/css-float.md
浏览文件 @
26059158
...
...
@@ -100,3 +100,84 @@ CSS 书写顺序
-
内减模式:box-sizing: border-box;
-
版心居中: margin: 0 auto;
## 清除浮动
清除浮动带来的影响
影响:如果子元素浮动了,此时子元素不能撑开标准流的块级父元素
[](
demo/css-float-4.html
':include :type=code'
)
[](
demo/css-float-4.html
':include height=220'
)
清除浮动的方法
1.
直接设置父元素高度
2.
额外标签
-
在父元素内容的最后添加一个块级元素
-
给添加的块级元素设置 clear:both;
```
css
.clearfix
{
clear
:
both
;
}
```
3.
单伪元素清除法
用伪元素替代了额外标签
优点:直接给标签加类即可清除浮动
(1)基本写法
```
css
.clearfix
::after
{
content
:
''
;
display
:
block
;
clear
:
both
;
}
```
(2)补充写法
```
css
.clearfix
::after
{
content
:
''
;
display
:
block
;
clear
:
both
;
/* 兼容低版本IE */
height
:
0
;
visibility
:
hidden
;
}
```
4.
双伪元素清除法
```
css
/* 解决外边距塌陷问题 */
.clearfix
::before
,
.clearfix
::after
{
content
:
''
;
display
:
table
;
}
.clearfix
::after
{
clear
:
both
;
}
```
5.
给父元素设置 overflow:hidden
```
css
overflow
:
hidden
;
```
[](
demo/css-float-5.html
':include :type=code'
)
[](
demo/css-float-5.html
':include height=240'
)
blog/front-end-learn/css-product.md
0 → 100644
浏览文件 @
26059158
# CSS 实战
网站项目目录
```
index.html
css
js
img
```
清除浏览器默认样式
```
css
/* reset.css */
*
{
margin
:
0
;
padding
:
0
;
/* 内减模式 */
box-sizing
:
border-box
;
}
li
{
list-style
:
none
;
}
a
{
text-decoration
:
none
;
}
/* 清除浮动 */
.clearfix
::before
,
.clearfix
::after
{
content
:
''
;
display
:
table
;
}
.clearfix
::after
{
clear
:
both
;
}
body
{
background-color
:
#f3f5f7
;
}
/* 版心居中 */
.wrapper
{
width
:
1200px
;
margin
:
0
auto
;
}
```
控制 input placeholder 样式
```
css
input
::placeholder
{
}
```
调节图片上下对齐
```
css
img
{
vertical-align
:
middel
;
}
```
通栏盒子
```
css
/* 占据屏幕整个宽度 */
.box
{
width
:
100%
;
}
```
blog/front-end-learn/demo/css-float-4.html
0 → 100644
浏览文件 @
26059158
<style>
/* 初始化样式 */
*
{
margin
:
0
;
padding
:
0
;
}
/* 外层容器 */
.box
{
background-color
:
#ccc
;
/* margin: 0 auto; */
}
/* 左边 */
.left
{
float
:
left
;
width
:
200px
;
height
:
200px
;
background-color
:
pink
;
}
/* 右边 */
.right
{
float
:
right
;
background-color
:
green
;
width
:
200px
;
height
:
200px
;
}
.footer
{
height
:
20px
;
background-color
:
saddlebrown
;
}
</style>
<div
class=
"box"
>
<div
class=
"left"
></div>
<div
class=
"right"
></div>
</div>
<!-- 期望footer元素紧跟box下面排列 -->
<div
class=
"footer"
></div>
\ No newline at end of file
blog/front-end-learn/demo/css-float-5.html
0 → 100644
浏览文件 @
26059158
<style>
/* 初始化样式 */
*
{
margin
:
0
;
padding
:
0
;
}
/* 外层容器 */
.box
{
background-color
:
#ccc
;
/* margin: 0 auto; */
}
/* 左边 */
.left
{
float
:
left
;
width
:
200px
;
height
:
200px
;
background-color
:
pink
;
}
/* 右边 */
.right
{
float
:
right
;
background-color
:
green
;
width
:
200px
;
height
:
200px
;
}
.footer
{
height
:
20px
;
background-color
:
saddlebrown
;
}
.clearfix
::before
,
.clearfix
::after
{
content
:
''
;
display
:
table
;
}
.clearfix
::after
{
clear
:
both
;
}
</style>
<!-- 清除浮动 -->
<div
class=
"box clearfix"
>
<div
class=
"left"
></div>
<div
class=
"right"
></div>
</div>
<!-- 期望footer元素紧跟box下面排列 -->
<div
class=
"footer"
></div>
\ No newline at end of file
blog/front-end-learn/index.md
浏览文件 @
26059158
...
...
@@ -31,3 +31,5 @@
8.
[
CSS 特性
](
blog/front-end-learn/css-priority.md
)
9.
[
CSS 浮动
](
blog/front-end-learn/css-float.md
)
10.
[
CSS 实战
](
blog/front-end-learn/css-product.md
)
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录