[英]Alignment of buttons
I've been trying to create this webpage off a course from udemy. 我一直在尝试从udemy的课程中创建此网页。 If you take a look at the picture you'll notice that at the bottom at the GET INVOLVED section, my buttons and texts are not aligned.
如果您查看图片,您会发现在“获取参与”部分的底部,我的按钮和文本未对齐。 I need advice on how to make these columns even so that the buttons are aligned.
我需要有关如何使这些列均匀对齐的建议。 Should I use margin/padding or is there another way?
我应该使用边距/填充还是其他方法?
假设说明是在div
编写的,请尝试为该div
赋予min-height
An age old question indeed: how to make 2+ div
s the same height? 确实有一个古老的问题:如何使2+
div
高度相同?
There have been many hacks and workarounds, but nowadays flexbox
comes to the rescue. 有许多黑客手段和变通办法,但如今,
flexbox
得以解救。
#wrapper { /* Something around those 3 columns */
display: flex;
}
.pill { /* Every column has this class */
flex: 1;
align-items: center;
display: flex;
justify-content: space-between;
flex-direction: column;
}
Example on JSFiddle JSFiddle上的示例
Before using this example, I would recommend reading something about flexbox
, maybe this exhaustive guide . 在使用本示例之前,我建议您阅读一些有关
flexbox
,也许是本详尽的指南 。
As stated below in the comments, there are some issues with cross-browser support at the moment. 如下面的评论中所述,目前跨浏览器支持存在一些问题。 More details here
在这里更多细节
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.