Ensure that the corner ribbon remains in place on the pricing table by making

Looking to enhance the functionality of a price table that features a corner ribbon? Currently, there is a hover effect on the price table that displaces the corner ribbon. Check out the code snippet below. The goal is to keep the corner ribbon sticky when hovered over, with a sliding transition.

CSS

.zoom:hover {
  transition: transform .5s ease;
  -webkit-transition: 0.3s;
  box-shadow: rgba(0, 0, 0, 0.35) 0px 5px 15px;
  transition: transform 300ms;
  transform: translate3d(0, -1%, 0);
}

/* RIBBON CSS */
.container__wrapper {
  left: 0px;
  position: absolute;
  top: 15px;
  height: 141px;
  width: 170px;
  overflow: hidden;
}

.container__ribbon {
  z-index: 100;
 left: -60px;
 position: absolute;
 top: 40px;
 height: 30px;
 width: 230px;
 transform: rotate(-45deg);
 background-color: #FF0000;
 display: flex;
 align-content: center;
 justify-content: center;
 box-shadow: rgba(0, 0, 0, 0.05) 0px 0px 0px 1px;
}

.container__ribbon h6 {
  font-size: 16px;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  color: #fff;
  align-self: center !important;
  font-weight: 400;
  padding-top: 0.3em;
}

/*___________________________________________________________ */
/* css for package */

/* SCROLLBARR CSS */
.card {
  border: 0 !important;
}

.scrollbar-dusty-grass::-webkit-scrollbar-track {
  box-shadow: inset 0 0 6px rgba(0, 0, 0, 0.1);
  background-color: #DAD8D9;
  border-radius: 10px;
}

.scrollbar-dusty-grass::-webkit-scrollbar {
  width: 12px;
  background-color: #F5F5F5;
}

.scrollbar-dusty-grass::-webkit-scrollbar-thumb {
  border-radius: 10px;
  box-shadow: inset 0 0 6px rgba(0, 0, 0, 0.0);
  background-image: -webkit-linear-gradient(330deg, #11A085 0%, #11A085 100%);
  background-image: linear-gradient(120deg, #11A085 0%, #11A085 100%);
}

.bordered-cyan::-webkit-scrollbar-thumb {
  box-shadow: none;
}

.square::-webkit-scrollbar-track {
  border-radius: 0 !important;
}

.square::-webkit-scrollbar-thumb {
  border-radius: 0 !important;
}

.thin::-webkit-scrollbar {
  width: 6px;
}

.example-1 {
  position: relative;
  overflow-y: scroll;
  height: 175px;
}

/* CAROUSEL */

.brderline {
  margin-top: 1rem;
  padding: .5rem;
  border: 1px solid #11A085;

}

/* PACKAGES TITLE */

.packagetitle h4 {
  color: #323232 !important;
  font-size: 15px;
  font-weight: 700;
}

.packagetitle h1 {
  color: #323232 !important;
  font-size: 35px;
  font-weight: 800;
}

.pkpara {
  font-family: 'Circular Std Book';
  font-size: 25px;
  color: #323232 !important;
  font-weight: 100;
  font-size: 20px;
}

/* PACKAGE BOX CSS */

/* .pk1 {
  border: 1px solid #11A085;
} */

.tagimg {
  position: absolute;
  top: 2%;
  left: 0;
  width: 120px !important;
  height: 120px;
}

.tagimg-r {
  position: absolute;
  top: 2%;
  right: 0;
  width: 120px !important;
  height: 120px;
}

.pkg1 h5 {
  font-size: 15px;
  color: #11A085;
}

.pkg1 h2 {
  font-size: 25px;
  color: #323232;
  font-weight: 700;
}

.pkg1 p {
  font-size: 16px;
  color: #8d8d8d;
  text-decoration: line-through;
}

.pkg1 h1 {
  color: #11A085;
  font-size: 45px;
  font-weight: 700;
  margin-bottom: 1rem;
}

ul.pkg-items>li {
  color: #323232;
  list-style: none;
  font-family: Circular Std Medium;
  font-style: normal;
}

ul.pkg-items li::before {
  content: "\2022";
  color: #8d8d8d;
  font-weight: bold;
  display: inline-block;
  width: 1.5rem;
}

.pkgbtn {
  text-align: center;
  margin: 2rem 0;
}

.innerpkgbtn {
  padding: 20px 60px !important;
}

.pkg1 h6 {
  font-size: 14px;
  color: #8d8d8d;
}

.viewmre h4 {
  padding: 1rem 0 !important;
  font-size: 14px;
  text-align: center;
}

.callnchat {
  font-size: 16px;
  text-align: center;
  margin-bottom: 2rem;
}

**

Answer №1

absolute

The element is taken out of the normal document flow, resulting in no space being allocated for it in the page layout. It is positioned relative to its closest ancestor that has a defined position, or if none exist, it's placed with respect to the initial container block. -MDN

When .container__wrapper is set to absolute positioning, ensure it aligns relative to a parent element that also has a set position and moves upon hover, such as the .item class. Refer to the code snippet below:

For more details on the usage of the position property, visit this link.

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

Differentiating CSS Styles for Odd and Even Table Elements

I am trying to implement a style where every other row in my table (myrow) has a different background color. However, currently it is only showing the color specified for odd rows. .myrow, .myrow:nth-of-type(odd) + .myrow:nth-of-type(even) ~ .myrow: ...

Instructions for including user ID in the URL after successfully logging in with their information

Hello everyone, I have a question and I would appreciate some help. I am attempting to ensure that when a user logs in with their credentials, their ID is passed and visible in the URL bar like this: ?id=000. I have been trying various ways but have not b ...

Clicking on a link initiates the dropdown menu for selecting an option

This project is specifically designed for mobile use, so there's no need to worry about how it will appear on desktop screens. In this project, I have an "a href" with an icon next to it that simulates a button. When a user clicks on it, a dropdown me ...

An error message pops up when using Next.js with Sass, indicating that a suitable loader is required to handle this file type

I've been struggling to properly wire up my next.js project with SCSS, but no matter what I try, it just won't work. I double-checked my setup for compiling SCSS files, but the error message keeps popping up: /scss/style.scss 1:0 Module parse f ...

Load options from server directory using PHP jQuery AJAX

I am faced with a file structure on my server that resembles the following: My query is quite complex: How can I dynamically populate <select> HTML tags from the contents of sub-files on a server? For instance, I have 3 <select> tags here tha ...

Issue with aligning CSS in Internet Explorer 7

Everything looks great on Firefox and IE8, but on IE 7 the middle "search input text field" is not aligned properly with the other two fields. It seems to be dropping down slightly. Here is the code - thank you for your help: <!DOCTYPE html PUBLIC "-/ ...

Distorted image display on Bootstrap card in Internet Explorer

My layout includes bootstrap v4 cards, but I'm having issues with distorted images in Internet Explorer 11. It seems that IE is not recognizing the height: auto attribute from the img-fluid class. Should I set a custom height for the card images? Inte ...

Firefox experiencing problem with retrieving video.duration in HTML5

I am currently working on developing a unique video player from scratch. <video preload="metadata" id="videoPlayer" style="width: 640px; height: 360px;"> </video> <script type="text/javascript"> var v = ""; var myV ...

Converting Greek text to UTF-8 using Javascript

Currently, I am working on a project with my teacher to digitalize a Greek textbook by transforming it into an online application. This process involves the conversion of a Shapefile, which draws polygons on maps along with polygon descriptions, and mappin ...

Locate specific elements on a webpage without scanning through the entire content

Is there a way to optimize the performance of getElementsByTagName("td") so it doesn't search the entire document? I'm experiencing long wait times for results. Here is an excerpt from my code: $ie.Document.getElementsByTagName("td") | ? {($_.c ...

Despite being correctly linked in EJS and without any errors, the CSS is still not loading

Hey there, I'm facing an issue with linking a CSS file to an EJS file. I believe that I am connecting them correctly: <head> <title>Acres & Karats Calculator</title> <base href="/"> <link type="text/css" href="css/Acres ...

The width of the HTML page seems to adjust or shift when I click on

I'm encountering an issue with my navbar. Whenever I open the dropdown menu, the width of my page changes but returns to normal when it is closed. <link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="styl ...

Experiencing inconsistencies with CSS on certain devices?

When faced with a research issue, I usually turn to Google for answers. However, this time, I was unsure of where to begin. As part of my efforts to enhance my frontend development skills, I undertook The Odin Project and worked on a calculator project. U ...

Why isn't the onChange function triggering in the input type text when the input is not manually typed in?

I am currently facing an issue with two text fields in my HTML form. Here is how they are set up: HTML : <input type="text" id="input1" onchange="doSomething();" disabled/> <input type="text" id="input2"/> JavaScript : function doSomething( ...

Easier JavaScript for numerous HTML elements

I am an aspiring JavaScript learner seeking advice. Currently, I am working on a website that features numerous items with multiple images for each. I am utilizing JQuery to display a larger image when the user hovers over a thumbnail image. My query is ...

When I employ ngroute, the Angular section in the html page does not display

I am looking to implement a fixed menu named "fixed_admin.html" on my website: <!DOCTYPE html> <!-- saved from url=(0069)https://hackerstribe.com/guide/IT-bootstrap-3.1.1/examples/dashboard/ --> <html lang="en"><head><meta htt ...

In Internet Explorer 7, there appears to be a white box that covers up the content on our website beyond a

I'm feeling stuck and frustrated trying to solve this issue. I have a Mac and no access to an IE7 machine, so I've been using browserlab (which is slow) to make any changes and see if they help. Unfortunately, I haven't been able to fix the ...

What is the appropriate method for passing parameters in PHP and how can you handle returned empty values

I'm looking to pass parameters in the action method because I am unable to do so via the header. <form name="mailinglist1" method="post" action="report1.php" > In this form, I'm using a download button to connect my report (HTML). ...

Utilizing the after pseudo element for an active selector in CSS

I'm struggling to make an active icon selector work with the after pseudo element. Here is the code I have attempted: <html> <head> <style type="text/css"> .btn{ width:25%; } .name{ background: #fff; color: #000; text-alig ...

Enhance the functionality of jQuery sortable by including additional details

I have a li list that I have implemented sortable functionality using jQuery. In order to ensure that the updated data is sent to the correct destination, I need to include some hidden values in the serialized data. How can I achieve this? HTML <ul i ...