css布局教程之如何实现垂直居中

fangyuan51549 26 0 PDF 2020-12-17 05:12:17

前言 最近在总结前端知识,也参加了一些面试,面试中遇到一道题要求垂直居中,现在对这进行一下总结,也好巩固一下知识。 css实现垂直居中 1.利用line-height实现居中,这种方法适合纯文字类的; <!-- css --> <style> .parents { height: 400px; line-height: 400px; width: 400px; border: 1px solid red; text-align: center; } .child { background-color: blue; color: #fff;

用户评论
请输入评论内容
评分:
暂无评论