简体   繁体   中英

Make bootstrap carousel background transparent

I am a newbie in CSS, and I wanted to make a carousel transparent on top of the colored div, how can I achieve this?

Below is my current results: 在此处输入图像描述

Then this is my html code:

<div class="second-phase">
        <!-- Tab for Carousel-->
        <div id="products-page-carousel"></div>

        <!--Carousel View-->
        <div id="carousel" class="carousel slide"  data-ride="carousel">

            <!-- The slideshow -->
            <div class="carousel-inner" >
                <div class="carousel-item active" id="my-carousel-bg" >
                    <center>
                        <img src="/media/g01hgi0m/branded-basin.png" alt="Los Angeles" width="30%" height="30%">
                    </center>
                </div>
                <div class="carousel-item" id="my-carousel-bg">
                    <center>
                        <img src="/media/waqd3xdw/branded-milk-crate.png" alt="Chicago" width="10%" height="10%">
                    </center>
                </div>
                <div class="carousel-item" id="my-carousel-bg">
                    <center>
                        <img src="/media/g01hgi0m/branded-basin.png" alt="New York" width="30%" height="30%">
                    </center>
                </div>
            </div>

            <!-- Left and right controls -->
            <a class="carousel-control-prev" href="#carousel" data-slide="prev">
                <img src="/media/aqrnoaxe/asset-1.png" width="17%"/>
            </a>
            <a class="carousel-control-next" href="#carousel" data-slide="next">
                <img src="/media/xqwj1jpx/asset-3.png" width="17%"/>
            </a>
        </div>    
    </div>

Then, also my CSS is here:

.second-phase{
    margin-top: -170px;
    height: 700px;
}
#my-carousel-bg{
    background-color: transparent;
    opacity: 2;
}

This is how my output is supposed to be:

在此处输入图像描述

You can not have multiple id tags on a single page. They should be unique within the entire document. Try changing from an id to a class and see if that fixes the problem.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM