CSS非标准响应式图片框架

问题描述 投票:0回答:1

我正在尝试为新闻部分的图片实现一个非标准框架。我的想法是让图片的 z-index 低于框架,并将框架放在它上面,并使它们响应。到目前为止我还没有运气。

<div class="mt-5 m-auto w-full">
    <!-- Swiper -->
    <div class="swiper news-swiper">
        <div class="swiper-wrapper">
            <div class="swiper-slide flex-col">
                <div class="news-gallery-image">
                    <img src="https://i.imgur.com/bRqr97Q.png" class="image" alt="forge your deck">
                    <img class="news-border" alt="borders"/>
                </div>
                <div class="w-auto mt-2">
                    <h1 class="text-1xl text-center">
                        HOTFIX #1.23 NOW LIVE!
                    </h1>
                </div>
            </div>
            <div class="swiper-slide flex-col">
                <div class="news-gallery-image">
                    <img src="https://i.imgur.com/bRqr97Q.png" class="image" alt="forge your deck">
                    <img class="news-border" alt="borders"/>
                </div>

                <div class="w-auto mt-2">
                    <h1 class="text-1xl text-center">
                        HOTFIX #1.23 NOW LIVE!
                    </h1>
                </div>
            </div>
            <div class="swiper-slide flex flex-col">
                <div class="news-gallery-image">
                    <img src="https://i.imgur.com/bRqr97Q.png" class="image" alt="forge your deck">
                    <img class="news-border" alt="borders"/>
                </div>
                <div class="w-auto mt-2">
                    <h1 class="text-1xl text-center">
                        HOTFIX #1.23 NOW LIVE!
                    </h1>
                </div>
            </div>
        </div>
    </div>
</div>

我有以下CSS。

.news-gallery-image {
    position: relative;
    height: 100%;
}

.news-gallery-image img {
    width: 100%;
    height: 100%;
}

.news-gallery-image .news-border {
    content: url("/resources/images/gallery-image-background-holder.png");
    border: none;
    position: absolute;
    top: 0;
    left: 0;
    z-index: 2;
}

The Frame

示例

您能帮忙一下吗^^.

html css responsive-design responsive
1个回答
0
投票

Edited Image

看起来代码是正确的,但图像导致了问题。尝试使用上面的图片

© www.soinside.com 2019 - 2024. All rights reserved.