移动设备上的 Bulma 模态间距

Bulma modal spacing on mobile

所以在查看 Bulma 文档 (https://bulma.io/documentation/components/modal/) 时,我在桌面和移动设备上都使用了模式,但我遇到了一些格式问题。

在 Bulma 上,移动视图不会在两侧添加任何间距,如下所示:

有谁知道在 Bulma 模态框上添加间距的本机方法吗?我使用 px-4 效果很好,但它也在桌面上添加了填充,但我有以下模式结构:

<div id="mobile-profile-modal" class="modal">
    <div class="modal-background"></div>
    <div class="modal-card px-4">
        <header class="modal-card-head">
            <p class="modal-card-title"><?= $user->get_first_name(); ?></p>
            <button class="delete" aria-label="close"></button>
        </header>
        <section class="modal-card-body">
            <div class="container">
                <div class="columns is-centered">
                    <div class="column">
                        <button class="button is-fullwidth">Profile</button>
                        <button class="button is-fullwidth">Settings</button>
                    </div>
                </div>
            </div>
        </section>
        <footer class="modal-card-foot">
            <button class="button is-fullwidth is-primary">
                        <span class="icon">
                          <i class="fas fa-sign-out-alt"></i>
                        </span>
                <span>Logout</span>
            </button>
        </footer>
    </div>
</div>

如果您不介意覆盖链接的 Bulma CSS 样式 sheet,您可以这样做:

<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Bulma Modal Example</title>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bulma@0.9.1/css/bulma.min.css">
<style type=text/css>
    .modal-card,
    .modal-content {
        margin: 0 20px;
        max-height: calc(100vh - 160px);
        overflow: auto;
        position: relative;
        /*remove width: 100%;*/
        width: calc(100% - 2em);
    }
    /*modal breakpoint*/
    @media screen and (min-width:769px) {
        .modal-card,
        .modal-content {
            margin: 0 auto;
            max-height: calc(100vh - 40px);
            width: 640px
        }
    }
</style>