What steps should be taken to transform this object into code?

In the code snippets provided below, I am trying to achieve the design outlined in the image.

.stone-item{
    width: 330px;
    transition: all .2s ease-in-out;
    -webkit-transition:  all .2s ease-in-out;
    -moz-transition:  all .2s ease-in-out; 
    -o-transition: all .2s ease-in-out;
    position: relative;
    margin: 0;
}
.stone-item img{
    width: 330px;
    height: 220px;
}
.stone-item .stone-content{
    transition: all .2s ease-in-out;
    -webkit-transition:  all .2s ease-in-out;
    -moz-transition:  all .2s ease-in-out;
    -o-transition: all .2s ease-in-out;
    position: absolute;
    bottom: -50%;
    left: 0;
    background: aqua;
}

I am encountering an issue with this code. It seems not to be working as expected.

Desired output:

Before hover: Image link

After mouse hover: Image link

Answer №1

Here is the code snippet for you to review.

HTML

<!doctype html>
<html>

  <head>
    <link rel="stylesheet" href="css.css">
  </head>

  <body>

    <div class="stone-item">
      <a href="#"><img src="https://i.sstatic.net/SjIvg.png" alt=""></a>
      <div class="stone-content">
        <h4>adsfasdf</h4>
        <p>
          Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet.
        </p>
      </div>
    </div>
  </body>

</html>

CSS

.stone-item {
  width: 330px;
  transition: all .2s ease-in-out;
  -webkit-transition: all .2s ease-in-out;
  -moz-transition: all .2s ease-in-out;
  -o-transition: all .2s ease-in-out;
  position: relative;
  margin: 0;
  overflow: hidden;
}

.stone-item img {
  width: 330px;
  height: 220px;
}

.stone-item .stone-content {
  transition: all .2s ease-in-out;
  -webkit-transition: all .2s ease-in-out;
  -moz-transition: all .2s ease-in-out;
  -o-transition: all .2s ease-in-out;
  position: absolute;
  bottom: calc(110px - 100%);
  left: 0;
  background: rgba(0, 255, 255, 0.6);
  width: 100%;
  padding: 20px;
  box-sizing: border-box;
}

.stone-item .stone-content h4 {
  margin: 0;
}

.stone-item:hover .stone-content {
  bottom: 0;
}

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

Create a text container that adjusts its size based on the content within

My goal is to create a unique display using CSS: I want to add various texts and lines to fill in the white space on the left and right sides. I have made some progress with this http://jsfiddle.net/g5jtm/, but I am facing a few issues: The text width ...

Using jQuery to specifically extract the second value from a comma-separated list stored in a hidden input

I'm working with these input fields: <input class="things" type="hidden" value="FirstItem,SecondItem"/> <input class="things" type="hidden" value="FirstItem,SecondItem"/> Is there a way to extract only the second values from these input ...

Is there a way to invoke a client-side function from the server?

Is there a way to display an alert at the top of the browser if the SQL query returns empty results? I tried using the "alert" function, but I'm struggling with customizing its appearance. I have a function in my HTML code that triggers an alert, but ...

Would it be acceptable to utilize Bootstrap rows as flex containers for their child divs, rather than employing columns?

Exploring the world of web development, I have delved into Bootstrap v4 for my personal projects. Following the grid system outlined in Bootstrap documentation, rows act as containers for columns. Interestingly, I found that Bootstrap rows are flex contain ...

How can we determine when a row has been modified while using a list of floating-left LIs?

Check out this list of products for an example: I have a function that is triggered on document ready which goes through each item in the list and adjusts the height of a span wrapping the image to ensure uniform spacing. My question is, is it possible f ...

Angular 5 form validation - validating user inputs

I am currently developing a MEAN stack application and working on implementing form validation. Everything seems to be functioning correctly except for the paragraph tag containing the error message, which is not displaying properly. Additionally, I want a ...

Move the image inside the box without directly following the mouse cursor, but at a slightly faster pace

I am facing an issue with a Vue component that allows me to zoom in on an image and move it around the container. The problem is, when the image is zoomed in, it moves faster than the mouse due to using the scale transform. Additionally, I noticed that cl ...

Changing color when mouse hovers using Jquery

Currently, I am in the process of converting a flash ad into an html5 ad. I found this demo here, and I would like to replicate the mouse hover effect showcased. When the cursor hovers over the details text in the banner, the entire background changes to ...

Swapping out data within a container

I've been experimenting with creating a hangman game using JavaScript and HTML. However, I'm facing an issue where clicking on a letter doesn't replace the "_" placeholder. var myList=["Computer","Algorithm","Software","Programming","Develop ...

Optimize my webpage for a specific location

While developing a game website, I am interested in learning how to enable only specific parts of my website to function while disabling the rest. How can this be achieved? ...

Utilizing Ajax to dynamically update the content of a div element

As a newcomer to Ajax, I am trying to use xmlhttprequest to dynamically change the content of a div by fetching HTML from different URLs. However, my code doesn't seem to be working as expected. Can someone help me identify what I might be doing wrong ...

Tips for using v-model with multiple arrays in Vue 3

Hey, I've been trying to implement a v-model to connect an input value to an object in an array of objects in Vue 3. The tricky part is that the object undergoes processing by a function before being used, and this processing needs to happen every tim ...

What is the most effective method for optimizing websites that do not respond to changes in window size

I've developed a website that is not responsive (it's more of an "experimental/artistic" site with a lot going on the screen, making it difficult to make it responsive..) I have decided not to cater for mobile phones, but I would like the site t ...

Retrieve items by name using an HTML array

I am dynamically adding new inputs and would like to read values from them dynamically as well. However, I am facing an issue where my championName variable is not working in JavaScript. <form name="second_form" id="second_form" action="#" method="PO ...

Based on the values pulled from the column in the SQLite database table, how can I display various icons on my HTML page?

Below is the query command I have in Python to paginate and display all blog posts on my website: @core.route('/', methods=['GET', 'POST']) def index(): form = Blogsearch_form(request.form) page = request.args.get(& ...

What is the best way to create divs that can close and hide themselves when clicked from inside the div itself?

I have a situation in my code where clicking a link reveals a div, and then the same link must be clicked again to hide it. However, I want to modify this so that any link within the div can also hide it when clicked. I currently have eight divs set up lik ...

Placing a dropdown menu on top of an image

I currently have a slightly rotated menu bar with two buttons as an example: https://i.stack.imgur.com/0sI2P.jpg Due to the rotation, normal HTML handling is not feasible. I am considering using a <map> element to create hyperlinks over the menu it ...

The size of the elements inside a div should be proportional to its parent div

I am struggling with sizing elements within a div. I have set the max-width to 40% and max-height to 25%, and inside is an image that I want to be 80% of its parent div. Here is the code snippet for reference: <div className="inputbox-container&qu ...

I am struggling to make my Bootstrap 5 Navbar transparent. Can anyone help me figure this out?

I've been struggling with my Bootstrap Navbar, which appears as white no matter what I do. I've tried numerous solutions from Stack Overflow to make it transparent without any luck. Even after setting the background to transparent and ensuring t ...

When you click on the image link, watch as the page gracefully transitions to a new one determined by the URL

I need assistance with a functionality where an image inside a div has a link to the next page. When this image is clicked, it should smoothly transition to the new page specified by its link. Any help with implementing this would be greatly appreciated. ...