【问题标题】:How to make Floating Action Button / Content overlap two divs in MaterializeCSS如何使浮动操作按钮/内容在 MaterializeCSS 中重叠两个 div
【发布时间】:2016-06-11 05:53:14
【问题描述】:

我正在查看 MaterializeCSS 展示 (materializecss.com/showcase.html),我看到了一个我想整合到我的网站中的功能。我希望能够使卡片、图片、按钮等能够重叠在两个 div(或部分​​)上。

例如: http://prntscr.com/bezcgohttp://prntscr.com/bezd7s 或 prntscr.com/bezdvx

显然图片与现场网站不同,但我正在寻找相同的想法。在第一张图片中,“hyperAPI”图片与蓝色和白色部分重叠。对于第二张图片,黄色向下箭头与蓝色和白色重叠。第三,红色向下箭头与浅蓝色和白色区域重叠。

澄清一下,我想知道如何使用 MaterializeCSS 框架 (materializecss.com) 做到这一点。

谢谢!另外,我不能发布超过两个链接,所以我不得不打破它们(对不起 D:)!

【问题讨论】:

    标签: html overlap materialize floating-action-button


    【解决方案1】:

    这是一个很受欢迎的效果:)

    我们对图像使用负边距,对标题使用等效填充...

    CSS

    .overlap-header {
        padding: 25px 25px 125px; /* Bottom padding has extra 100px */
        text-align: center;
        background: #333;
        color: #fff;
        position: relative;
    }
    .half-out-button {
        position: absolute;
        bottom: 0;
        right: 5%;
        height: 70px;
        width: 70px;
        border-radius: 50%;
        margin-bottom: -35px; /* Change this as you like */
    }
    .overlap-img {
        position: relative;
        display: block;
        max-width: 80%;
        margin: -100px auto 25px; /* top margin is -100px */
    }
    

    HTML - 按钮

    <div class="overlap-header">
        <h1>Awesome overlapping</h1>
        <button class="half-out-button"> Half out! </button>
    </div>
    

    HTML - 图片

    <div class="overlap-header">
        <h1>Awesome overlapping</h1>
    </div>
    <img src="https://pixabay.com/static/uploads/photo/2016/04/25/23/53/euro-1353420_960_720.jpg" class="overlap-img">
    

    这是 http://codepen.io/shramee/pen/zBreLN 的代码笔

    【讨论】:

    • 更新答案以包含按钮 ;)
    猜你喜欢
    • 2020-03-19
    • 2019-08-05
    • 1970-01-01
    • 2017-08-03
    • 2020-09-23
    • 1970-01-01
    • 2016-03-27
    • 1970-01-01
    • 2015-11-08
    相关资源
    最近更新 更多