css常用元素水平垂直居中方案 下载 q10244 21 0 PDF 2021-02-24 01:02:42 flex实现水平垂直居中 适用场景:父子宽高都可未知(比较推荐这种方式,简单,而且目前兼容性也不错。) <html> <head> <style> .parent { width: 100%; height: 100px; background: cyan; display: flex; justify-content: center; align-items: center; } 立即下载 微信扫一扫:分享 微信里点“发现”,扫一下 二维码便可将本文分享至朋友圈。