Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
檀越@新空间
Coding Tree
提交
fe2e24b1
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看板
提交
fe2e24b1
编写于
1月 14, 2022
作者:
彭世瑜
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix
上级
424f5519
变更
2
显示空白变更内容
内联
并排
Showing
2 changed file
with
101 addition
and
0 deletion
+101
-0
blog/front-end-learn/css-box.md
blog/front-end-learn/css-box.md
+65
-0
blog/front-end-learn/demo/css-box-1.html
blog/front-end-learn/demo/css-box-1.html
+36
-0
未找到文件。
blog/front-end-learn/css-box.md
浏览文件 @
fe2e24b1
...
...
@@ -64,3 +64,68 @@ display: block;
-
a 标签内部可以嵌套任意内容
> a 标签不能嵌套 a 标签
## 盒子模型
(1)盒子
标签可以看做是一个盒子
(2)盒子模型:
-
外边距区域 margin
-
边框区域 border
-
内边距区域 padding
-
内容区域 content
(3)盒子内容的宽高
-
width
-
height
(4)边框
```
css
/* 粗细 线条样式 颜色(不分先后顺序)*/
/* 默认4个方向都有*/
border
:
10
px
solid
red
;
/* 单个方向 */
border-top
:
10
px
solid
red
;
border-bottom
:
10
px
solid
red
;
border-left
:
10
px
solid
red
;
border-right
:
10
px
solid
red
;
/* 单个属性 */
border-width
:
边框粗细
border-style
:
边框样式
border-color
:
边框颜色
```
线条可选样式
-
solid 实线
-
dashed 虚线
-
dotted 点线
盒子尺寸 = width / height + 边框线
布局顺序:从外到内,从上到下
(5)内边距 padding
```
css
/* 可取 4 个值、3 个值、2 个值、1 个值 */
padding
:
上
右
下
左
;
padding
:
上
左右
下
;
padding
:
上下
左右
;
padding
:
上下左右
;
```
规律:顺时针,值不够看对边
(6)导航实例
[](
demo/css-box-1.html
':include :type=code'
)
[](
demo/css-box-1.html
':include height=70'
)
blog/front-end-learn/demo/css-box-1.html
0 → 100644
浏览文件 @
fe2e24b1
<style>
.box
{
border-top
:
3px
solid
#ff8500
;
border-bottom
:
#edeef0
;
}
.box
a
{
/* 先写盒子大小 */
display
:
inline-block
;
width
:
80px
;
height
:
40px
;
/* 推荐先写上背景,便于查看盒子大小 */
/* background-color: #edeef0; */
/* 再写文字样式 */
line-height
:
40px
;
text-align
:
center
;
color
:
#4c4c4c
;
font-size
:
12px
;
text-decoration
:
none
;
}
/* 鼠标悬停效果 */
.box
a
:hover
{
background-color
:
#edeef0
;
color
:
#ff8044
;
}
</style>
<div
class=
"box"
>
<a
href=
"#"
>
首页
</a>
<a
href=
"#"
>
文章
</a>
<a
href=
"#"
>
分类
</a>
<a
href=
"#"
>
标签
</a>
</div>
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录