为什么vertical-align不生效呢?求解为什么没有垂直居中
1条回答 默认 最新
- bingbingyihao 2022-11-12 23:35关注
回答:需要将父元素设置一下行高:可以参考这篇文章:https://blog.csdn.net/qq_43677117/article/details/109475579
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Document</title> <style> .one { width: 400px; height: 400px; background-color: red; margin: 0 auto; text-align: center; line-height: 400px; } .two { width: 300px; height: 300px; line-height: 300px; background-color: green; display: inline-block; vertical-align: middle; } .three { width: 200px; height: 200px; background-color: blue; display: inline-block; } </style> </head> <body> <div class="one"> <div class="two"> <div class="three"> </div> </div> </div> </body> </html>
本回答被题主选为最佳回答 , 对您是否有帮助呢?解决 1无用
悬赏问题
- ¥15 自适应 AR 模型 参数估计Matlab程序
- ¥100 角动量包络面如何用MATLAB绘制
- ¥15 merge函数占用内存过大
- ¥15 Revit2020下载问题
- ¥15 使用EMD去噪处理RML2016数据集时候的原理
- ¥15 神经网络预测均方误差很小 但是图像上看着差别太大
- ¥15 单片机无法进入HAL_TIM_PWM_PulseFinishedCallback回调函数
- ¥15 Oracle中如何从clob类型截取特定字符串后面的字符
- ¥15 想通过pywinauto自动电机应用程序按钮,但是找不到应用程序按钮信息
- ¥15 如何在炒股软件中,爬到我想看的日k线