Issue with CSS positioning: Struggling to place images outside a div with floating properties

Here is what I need to design along with the code I have written,

HTML:

    <div className='relative mt-64 mb-40 md:h-56 h-36 w-full gradient z-10'>
                <img className='bg-transparent w-20 h-28 absolute md:top-40 md:left-10 -left-10 z-50 ' src="images/Frame.png" alt="" />
                <img className='bg-transparent w-20 h-28 absolute md:top-10 md:right-10 -right-10 z-50' src="images/Frame.png" alt="" />
               
            </div>

CSS

.gradient{
    background: linear-gradient(90deg, #9C4F96 0%, #FF6355 17.19%, #FBA949 34.38%, #FAE442 49.48%, #8BD448 69.79%, #2AA8F2 100%);
    transform: skewY(-7deg);
    overflow: hidden;
    clip-path: polygon(0% 0, 100% 0, 100% 100%, 0% 100%);
    
}

However, the output I am getting looks like this

I attempted to remove the clip-path property to check if that was causing any issues but it did not solve the problem.

Answer №1

If you simply remove the overflow-hidden and unnecessary clip path, your code should work fine. Take a look at this example where I used both your old gradient and a new one layered on top of each other: Check out the code in action

Additionally, I adjusted the position of the right image as it seemed off during testing.

<div className="relative mt-64 mb-40 md:h-56 h-36 w-screen gradient">
  <img className="bg-transparent w-20 h-28 absolute md:top-40 md:left-10 -left-10 z-50 " src="images/Frame.png" alt="" />
  <img className="bg-transparent w-20 h-28 absolute md:-top-10 md:right-10 -right-10 z-50" src="images/Frame.png" alt="" />
</div>
.gradient{
  background: linear-gradient(90deg, #9C4F96 0%, #FF6355 17.19%, #FBA949 34.38%, #FAE442 49.48%, #8BD448 69.79%, #2AA8F2 100%);
  transform: skewY(-7deg);
}

I trust this solution will be beneficial to you. Have an amazing day!

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

Is there a way to set up my React Application to run in Jenkins prior to executing Cypress tests?

Running Cypress in Jenkins requires the React application to be executed beforehand. However, while Jenkins is running the React application, it encounters the following error: Error from chokidar (/data/node_modules/@babel/runtime/regenerator): Error: EN ...

Express/React: Using Relative Paths for Static Files

Currently, my react client is running on localhost:3000 while my express server is running on localhost:4000. In the server, there is a static folder containing images. I am facing an issue where I need to store the image path in a MySQL database and use ...

Managing the state in NextJS applications

I've scoured the depths of the internet in search of a solution for this issue, but unfortunately I have yet to come across one that effectively resolves it. I've experimented with various state management tools including: useContext Redux Zusta ...

Page flickers when jQuery is used to scroll to an element

One issue I have encountered is with a link that, when clicked, should scroll down to a specific element on the page. However, every time I test this feature, there seems to be an inconsistency where the page may momentarily flash before scrolling as inte ...

Stylesheet specific to Internet Explorer not loading

My Rails application (link) is experiencing display bugs in Internet Explorer. I am trying to fix these bugs by making changes in the app/views/layouts/application.html.haml file where I have included: /[if IE] ...

Tips for swapping out various react components within the same page

I have a user dashboard built using material-ui list, where each listItem has its own component. What I'm trying to achieve is to have a section dedicated to switching between these components when a list element is clicked. However, I'm facing d ...

What causes images to unexpectedly expand to fill the entire screen upon switching routes in Next.js?

I'm in the process of creating a website using Next and Typescript, with some interesting packages incorporated: Framer-motion for smooth page transitions Gsap for easy animations One issue I encountered was when setting images like this: <Link&g ...

Toggle the backgroundImage visibility by setting it to either hidden or displayed using jquery

$('.arrow').css("background-image", "url('../img/arrow.png')").hide(); I have implemented a custom solution using CSS and jQuery to hide the downward arrow when scrolling down on my webpage. `$( document ).ready(function() {
 co ...

What is preventing my CSS Animation from activating on my website?

Is there something in the code preventing the animation from working properly? .projectLinks a{ background-color: var(--secondary-color); color: var(--main-color); padding: 2px 4px 4px 4px; border-radius: 15px; margin-right: 25px; text-decorati ...

What is the best way to integrate JSS styles into a React application that is using Material UI

I have multiple .js files that utilize { makeStyles } from "@material-ui/core/styles"; to create jss. I am using className={classes.myClass} and then calling it with const classes = useStyles();. This is a common setup, but the issue arises when I need to ...

Tips for effectively handling color inheritance within Bootstrap 5

I need to customize Bootstrap 5 .text-success color for better contrast on my custom .bg-lvlN classes. Here is how I have defined them: .bg-lvl1 { background-color: #303333; } .bg-lvl2 { background-color: #222424; } /* Overriding .text-success c ...

Troubleshooting: React App Fails to Display Video with Google Cloud Storage URLs due to Video.js Player Initialization Issue

Currently, I am utilizing Video.js to encapsulate Google Cloud Storage video public URLs. By doing this, I am able to customize its appearance and control the exact second at which the video starts playing (e.g. play at 12 seconds). In my React app page.t ...

When I execute the command `npm run start`, why does Tailwind not function properly while it works perfectly fine when I use `ng serve

I am working on an Angular 15 application that incorporates Tailwind CSS. Here is my Proxy.conf.json file: { "/api/": { "target": "http://localhost:8080", "secure": false, "changeOrigin&qu ...

How to Disable Scrollwheel in Google Maps Using React Library

Is it possible to deactivate the scroll wheel feature? I'm struggling with implementing this in google-maps-react. I attempted the following: defaultOptions={{ scrollwheel: false, }} and also this: MAP_OPTIONS = { scrollwheel: false, } Un ...

I have successfully added an image to my CSS file, and it is appearing in Chrome's inspect feature. However, the image is not visible on the actual website

Here is the code snippet: .nav-link-apple { width: 1.6rem; background: 4.4rem; background: url(./Logo.jpg) center no-repeat; } Although the image I added can be seen in inspect on Chrome, it is not visible on the actual webpage. I have tried s ...

When an input element is being controlled from outside the modal using a portal, it is losing focus after a key press

[Resolved] The input component is experiencing a focus issue when any key is pressed, only when its value is controlled from outside of the portal. NOTE: I apologize for any confusion. While writing this post, I identified the problem in my code, but dec ...

I encountered the following error message: Unable to access properties of undefined (specifically 'header'). I am currently attempting to utilize middleware to retrieve user data

I recently set up a middleware folder and created fetchuser.js within it. The purpose of my fetchuser.js code is to create a getuser endpoint for user authentication. However, I encountered an error while trying to make a new post request using thunderclie ...

Utilize express.router() to send a get request to a third-party API while including an API key

As I develop my react application, I am faced with the task of retrieving data from a third-party site that requires me to include an API key in the header as 'X-Auth-Token'. Currently, I am using the fetch() API from the client-side JavaScript ...

Tips for displaying the webpage background above a specific div by utilizing a differently shaped div

I designed a webpage with a background image. At the top, I placed a div element (let's call it div_1) set to 50% width which creates a horizontal black bar with 60% opacity. Directly above that, towards the left at 50%, I want another div element (di ...

Displaying nested JSON data in a user interface using React

I have a complex nested JSON structure that I am using to build a user interface. While I have successfully implemented the first part, I am encountering difficulties with the second part. My Objective The nested JSON displays parent elements and now I a ...