position: absolute;
width: 宽度;
left: 0;
right: 0;
margin: 0 auto;
.parent {
background: #eee;
width: 300px;
height: 300px;
position: relative;
}
.block {
background: skyblue;
width: 100px;
height: 100px;
position: absolute;
left: 0;
right: 0;
margin: 0 auto;
}
.inline {
background: pink;
position: absolute;
width: 100px;
left: 0;
right: 0;
margin: 0 auto;
}
===============================================================
父元素 height: 高度;
行内元素 line-height: 高度;
.parent {
background: #eee;
width: 300px;
height: 300px;
}
.inline {
background: pink;
line-height: 300px;
}
父元素 display: table-cell;
子元素 vertical-align: middle;
.parent {
background: #eee;
width: 300px;
height: 300px;
display: table-cell;
vertical-align: middle;
}
display: flex;
align-items: center;
.parent {
background: #eee;
width: 300px;
height: 300px;
display: flex;
align-items: center;
}
.block {
background: skyblue;
width: 100px;
height: 100px;
}
.inline {
background: pink;
}
position: absolute;
top: 50%;
height: 高度;
margin-top: -0.5高度;
.parent {
background: #eee;
width: 300px;
height: 300px;
position: relative;
}
.block {
background: skyblue;
width: 100px;
height: 100px;
position: absolute;
top: 50%;
margin-top: -50px;
}
.inline {
background: pink;
height: 100px;
position: absolute;
top: 50%;
margin-top: -50px;
}
position: absolute;
top: 50%;
transform: translate( 0, -50%);
.parent {
background: #eee;
width: 300px;
height: 300px;
position: relative;
}
.block {
background: skyblue;
width: 100px;
height: 100px;
position: absolute;
top: 50%;
transform: translate( 0, -50%);
}
.inline {
background: pink;
height: 100px;
position: absolute;
top: 50%;
transform: translate( 0, -50%);
}
position: absolute;
height: 高度;
top: 0;
bottom: 0;
margin: auto 0;
.parent {
background: #eee;
width: 300px;
height: 300px;
position: relative;
}
.block {
background: skyblue;
width: 100px;
height: 100px;
position: absolute;
top: 0;
bottom: 0;
margin: auto 0;
}
.inline {
background: pink;
position: absolute;
height: 100px;
top: 0;
bottom: 0;
margin: auto 0;
}
===================================================================
绝对定位 transform
position:absolute;
top:50%;
left:50%;
transform:translate(-50%,-50%)
.parent {
background: #eee;
width: 300px;
height: 300px;
position: relative;
}
.block {
background: skyblue;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50% ,-50%);
}
绝对定位 margin
position:absolute;
top:50%;
left:50%;
margin-top:-(height/2)px;
margin-left:-(width/2)px;
.parent {
background: #eee;
width: 300px;
height: 300px;
position: relative;
}
.block {
background: skyblue;
width: 100px;
height: 100px;
position: absolute;
top: 50%;
left: 50%;
margin-top: -50px;
margin-left: -50px;
}
绝对定位 margin:auto
position:absolute/fixed;
top:0;left:0;right:0;bottom:0;
margin:atuo;
.parent {
background: #eee;
width: 300px;
height: 300px;
position: relative;
}
.block {
background: skyblue;
width: 100px;
height: 100px;
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
margin: auto;
}
绝对定位 calc 水平、垂直居中也可以使用此方法
position:absolute;
top:calc(50% - (height/2)px);
left:calc(50% - (width/2)px);
.parent {
background: #eee;
width: 300px;
height: 300px;
position: relative;
}
.block {
background: skyblue;
position: absolute;
自我介绍一下,小编13年上海交大毕业,曾经在小公司待过,也去过华为、OPPO等大厂,18年进入阿里一直到现在。
深知大多数前端工程师,想要提升技能,往往是自己摸索成长或者是报班学习,但对于培训机构动则几千的学费,着实压力不小。自己不成体系的自学效果低效又漫长,而且极易碰到天花板技术停滞不前!
因此收集整理了一份《2024年Web前端开发全套学习资料》,初衷也很简单,就是希望能够帮助到想自学提升又不知道该从何学起的朋友,同时减轻大家的负担。
既有适合小白学习的零基础资料,也有适合3年以上经验的小伙伴深入学习提升的进阶课程,基本涵盖了95%以上前端开发知识点,真正体系化!
由于文件比较大,这里只是将部分目录大纲截图出来,每个节点里面都包含大厂面经、学习笔记、源码讲义、实战项目、讲解视频,并且后续会持续更新
如果你觉得这些内容对你有帮助,可以添加V获取:vip1024c (备注前端)
总结
我在成长过程中也是一路摸爬滚打,没有任何人的指点,所以走的很艰难。例如在大三的时候,如果有个学长可以阶段性的指点一二,如果有已经工作的师兄可以告诉我工作上需要什么,我应该前面的三年可以缩短一半;后来去面试bat,失败了有5、6次,每次也不知道具体是什么原因,都是靠面试回忆去猜测可能是哪方面的问题,回来学习和完善,当你真正去招人的时候,你就会知道面试记录是多么重要,面试官可以从面试记录里看到你的成长,总是去面试,总是没有成长,就会被定义为缺乏潜力。
一个人可以走的很快,但一群人才能走的更远。不论你是正从事IT行业的老鸟或是对IT行业感兴趣的新人,都欢迎扫码加入我们的的圈子(技术交流、学习资源、职场吐槽、大厂内推、面试辅导),让我们一起学习成长!
,也有适合3年以上经验的小伙伴深入学习提升的进阶课程,基本涵盖了95%以上前端开发知识点,真正体系化!**
由于文件比较大,这里只是将部分目录大纲截图出来,每个节点里面都包含大厂面经、学习笔记、源码讲义、实战项目、讲解视频,并且后续会持续更新
如果你觉得这些内容对你有帮助,可以添加V获取:vip1024c (备注前端)
[外链图片转存中…(img-4bEGLL35-1712651997031)]
总结
我在成长过程中也是一路摸爬滚打,没有任何人的指点,所以走的很艰难。例如在大三的时候,如果有个学长可以阶段性的指点一二,如果有已经工作的师兄可以告诉我工作上需要什么,我应该前面的三年可以缩短一半;后来去面试bat,失败了有5、6次,每次也不知道具体是什么原因,都是靠面试回忆去猜测可能是哪方面的问题,回来学习和完善,当你真正去招人的时候,你就会知道面试记录是多么重要,面试官可以从面试记录里看到你的成长,总是去面试,总是没有成长,就会被定义为缺乏潜力。
[外链图片转存中…(img-Q4UjGBbo-1712651997031)]
[外链图片转存中…(img-4vOjmIRD-1712651997031)]
一个人可以走的很快,但一群人才能走的更远。不论你是正从事IT行业的老鸟或是对IT行业感兴趣的新人,都欢迎扫码加入我们的的圈子(技术交流、学习资源、职场吐槽、大厂内推、面试辅导),让我们一起学习成长!
[外链图片转存中…(img-iR1YNzdT-1712651997031)]