【问题标题】:Absolute position button (& center modal that it's in)绝对位置按钮(使其所在的模态居中)
【发布时间】:2019-09-15 12:46:15
【问题描述】:

我不知道如何让这个模式中的按钮表现得像我想要的那样。我需要它距离模态底部 20 像素(当然要居中)。

模态本身似乎也没有居中。请帮我也这样做。

我会把网址放在 cmets 中。

只需点击网站顶部的“与您的赞助商会面”按钮,即可打开模式。

【问题讨论】:

    标签: css button modal-dialog absolute


    【解决方案1】:

    删除包裹<button> 的外部<div> 并将以下css 添加到您的按钮类,即.md-content button

    position: absolute;
    left: 0; (instead of left: 109.2px; used by you)
    right: 0;
    

    整个班级是这样的:

    .md-content button {
        background: rgba(0,0,0,0.5);
        color: #fff;
        box-shadow: 0px 8px 15px rgba(0, 0, 0, 0.5);
        transition: all 0.3s ease 0s;
        text-align: center;
        bottom: 20px;
        position: absolute;
        left: 0;
        right: 0;
    }
    

    【讨论】:

    • 嗨,Ganesh。非常感谢,这修复了按钮!
    • Nvm,我明白了。模态现在居中,这样就完成了。 :p
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-03-22
    • 2012-01-20
    • 2016-08-25
    • 2012-04-17
    • 2020-06-07
    • 1970-01-01
    相关资源
    最近更新 更多