Place a PNG image within a div container carousel

Despite my efforts, I have been unable to find an example of what I am trying to achieve. I have a carousel and my goal is to insert a PNG image into the carousel in such a way that it slightly exceeds the top of the div like this:

https://i.sstatic.net/M0jSC.jpg

As you can see, the PNG image slightly protrudes from the top of the div

I have already attempted the following: https://codepen.io/MehdiX/pen/jOEaJox?editors=1100

However, it does not work as expected. When I use a negative pixel value, the borders of the PNG image are no longer visible.

I have applied 'position: absolute;' to my PNG image and 'position: relative;' to the carousel div, but it does not seem to work. I am unsure whether I should focus on the div of the carousel or the image itself (which is already relative).

HTML :

<main id="home_part" class="row" role="main">

        <article>
            <div id="carousel_presentation" class="col-md-12">
                <div id="carouselExampleIndicators" class="carousel slide" data-ride="carousel" data-interval="false">
                    <ol class="carousel-indicators">
                        <li data-target="#carouselExampleIndicators" data-slide-to="0" class="active"></li>
                        <li data-target="#carouselExampleIndicators" data-slide-to="1"></li>
                        <li data-target="#carouselExampleIndicators" data-slide-to="2"></li>
                    </ol>
                    <div class="carousel-inner">
                        <div class="carousel-item active">
                            <img src="https://images.pexels.com/photos/204993/pexels-photo-204993.jpeg?auto=compress&cs=tinysrgb&dpr=1&w=500" class="d-block w-100" alt="...">
                            <img src="https://retohercules.com/images/foto-png-online-8.png" class="women_png_sticky" alt="">
                        </div>
                        <div class="carousel-item">
                            <img src="..." class="d-block w-100" alt="...">
                        </div>
                        <div class="carousel-item">
                            <img src="..." class="d-block w-100" alt="...">
                        </div>
                    </div>
                    <a class="carousel-control-prev" href="#carouselExampleIndicators" role="button" data-slide="prev">
                        <span class="carousel-control-prev-icon" aria-hidden="true"></span>
                        <span class="sr-only">Previous</span>
                    </a>
                    <a class="carousel-control-next" href="#carouselExampleIndicators" role="button" data-slide="next">
                        <span class="carousel-control-next-icon" aria-hidden="true"></span>
                        <span class="sr-only">Next</span>
                    </a>
                </div>

                <div class="col-md-12 text-center py-5">
                    <div class="container">
                        <h2 class="mb-3">Laissez-vous emporter par le bien-être !</h2>
                        <p class="lead">Échappez au stress du monde moderne et venez nous retrouver dans notre institut de soins. Vous y trouverez sérénité et bien-être dans un environnement calme et apaisant.</p>
                    </div>
                </div>
            </div>
        </article>

    </main>
#carousel_presentation {
    font-family: main, "Palatino Linotype", "Book Antiqua", Palatino, serif;
    padding: 0;
    color: #565656;
    background-color: #FFF989;
    position: relative;
}

.women_png_sticky {
    margin-top: -600px;
}

#carousel_presentation h2 {
    font-size: 2rem;
    text-transform: uppercase;
}

@media only screen and (max-width: 780px) {
    #carousel_presentation h2 {
        font-size: 1.5rem;
    }
}

@media only screen and (max-width: 560px) {
    #carousel_presentation h2 {
        font-size: 1rem;
        text-decoration: underline;
    }

    #carousel_presentation p {
        font-size: 1rem;
    }
}

Is there a simple solution, like using canvas in JavaScript or CSS, to handle this type of positioning?

Answer №1

An issue has been identified in your carousel.scss file on line 25 where the overflow: hidden rule is causing the image to be hidden.

.carousel-inner {
  position: relative;
  width: 100%;
  overflow: hidden;
  @include clearfix();
}

To solve this issue, you can create a more specific selector to override the overflow property:

div.carousel-inner { overflow: visible }

For reference, you can view the updated code on Codepen: https://codepen.io/rafaelcastrocouto/pen/JjoOqXy?editors=1100

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

style for a bootstrap form input

Can the form-control from Bootstrap be made inline for input without relying on the grid system like col-md-2? This is the one aspect of Bootstrap that I find particularly frustrating. ...

Creating a search-enabled dropdown menu using Bootstrap 4

What is the process for incorporating the data-live-search="true" feature into a dropdown using bootstrap 4? I found a helpful explanation in the following link, but it appears to be specific to Bootstrap 3. Bootstrap 3 select ...

Ways to reduce the size of the border on the bottom in HTML/CSS

Currently, I am working with a div container (utilizing bootstrap.min.css) that contains another class called divborder. The length of the border-bottom in divborder is quite long and I'm wondering how I can adjust it to be shorter. Below is a snippe ...

The CSS code seems to be ineffective when attempting to center elements with a specific width in react.js

Hey everyone, I'm currently working on developing a web application using react-bootstrap and I've encountered an issue with adjusting the width of my row and centering it. I have already created the necessary CSS and JS files, but I am unable to ...

Encountering an error while attempting to load the jQuery script: TypeError - $.fn.appear.run is not a

I have included an animation script for CSS in my markup, but I am encountering the following error: TypeError: $.fn.appear.run is not a function Does anyone know why this is happening and how I can resolve it? /* * CSS3 Animate it * Copyright (c) 2 ...

How can you inform TypeScript about a file that will be included using a script tag?

I am currently utilizing TypeScript for my front-end JavaScript development, and I have a situation where I am loading two scripts from my index.html file as shown below: <script src="replacements.js"></script> <script src="socket.js">&l ...

What is the best way to ensure that each link displays unique text in a separate div when clicked on?

<aside class="side_article_content"><p id="defaultText">Chakras are explained here.</p> <p id="baseChakraInfo" style="display:none;">Base Chakra details here.</p> <p id="sacralChakraInfo" style="display:none;">Sa ...

Switch navigation - always display the menu on the existing page

I have a toggle menu implemented. Please check out the code and functionality on JsFiddle When clicking on a h3 tag like Category 1 (which is an a tag), the menu opens and remains open on the current page. However, if you click on the h3 tag (Category1) ...

Looping Issue in WordPress

Here is the code snippet I am currently working with: <?php query_posts("order=ASC&cat=4"); ?> <?php if(have_posts()): while(have_posts()): the_post(); ?> <?php if(get_post_custom_values("show") != NULL): ?> ...

Tips for changing text color based on background dynamically in Bootstrap SASS?

Here's a thought-provoking query for those who have experience working with Bootstrap 4 sass. According to Bootstrap's documentation, when the parent block has the class .bg-dark, adding the .text-light class to the HTML is essential for achievin ...

Center the middle item in a flexbox column arrangement

I'm working on a layout where I have three items stacked vertically within a column. My goal is to center the middle item (green) in the column and have the other items positioned around it. Here's my current setup: .flex-row { display: fl ...

One way to create dynamic function parameters in JavaScript is by using

Currently, I am in the process of implementing a payment API checkout feature on my order.html page. However, I have encountered an issue where I need to add a script in the head of the HTML document. This script requires me to specify the subtotal amoun ...

How feasible is it to customize the "ionic-img-viewer" npm package or replicate its image styling in Ionic 2?

I am wondering if it is possible to edit or add additional styles when my image is viewed using the "ionic-img-viewer" npm package. Alternatively, how can I apply the same styles as those on my original image tag? For example, here is my img tag with some ...

When attempting to capture an element screenshot as PNG, a TypeError occurs indicating that the 'bytes' object is not callable

Can someone please help me figure out how to save a screenshot of a specific element in Selenium using Python3? Here is the code I am trying: from selenium import webdriver import pyautogui as pog import time options = webdriver.ChromeOptions() options ...

Styling a HTML div element with a header and footer, while also ensuring that the

My goal is to create a div that features a header with a unique background design. The content within the div should have a background consisting of a one-pixel repetition at y, or maybe something different? I also want a footer with its own distinctive ...

Attempting to design a customized tooltip for an SVG element embedded within the HTML code

Recently, I've delved into Js with the goal of creating an interactive pronunciation guide using inline svg. If you're curious to see what I've done so far, check it out here. My current focus is on incorporating basic styled tooltips that ...

Triggering hovers inside one div by hovering over another div

Currently stuck on a project and unable to find a solution after trying various approaches. Here is the link to the task at hand... The objective is to make all inner divs animate simultaneously when the outer div is rolled over. Additionally, clicking on ...

Angular 8 form controls becoming unresponsive while the list is being loaded

Hello, I am currently experiencing an issue in Angular. I have a page with a basic Angular form and two independent components that load lists from an API (comments with 500+ records and posts with 500+ records). The Problem: While trying to enter values ...

Modify the HTML input type color in React.js only after releasing the mouse button

<input className="color-palatte" type="color" onChange={(e) => onColorChange(e)} /> When interacting with the color palette, I have set up an API call to trigger only when I release the slider instead of continuous calls while sliding over the co ...

Issues with Bootstrap nav-tabs functionality have been reported in the 4.6 version specifically within an asp webform environment

I am currently working with Bootstrap 4.6 and attempting to utilize the nav function to create navigation tabs. However, I am encountering an issue where clicking on another tab does not trigger the expected behavior. The code snippet in question is as fol ...