Is it possible to incorporate half an image into a slideshow using html and css?

Hello, I need help modifying this code:

<div>
    <div style="width:100%">
        <img src="images/o.jpg" alt="" style="width:100px;height:100px;justify-content: center;padding-left:50%" />
    </div>

    <div id="flipbook">
        <div class="slide">
            <img src="images/1.jpg" alt="" />
            <div class="content"><a href="#">Flowers: What you didn't know</a></div>
        </div>
        <div class="slide">
            <img src="images/2.jpg" alt="" />
            <div class="content"><a href="#">Flowers: Real or Fiction?</a></div>
        </div>
        <div class="slide">
            <img src="images/3.jpg" alt="" />
            <div class="content"><a href="#">A Flower ate my Baby!</a></div>
        </div>
        <div class="slide">
            <img src="images/4.jpg" alt="" />
            <div class="content"><a href="#">Will Flowers Destroy Earth?</a></div>
        </div>
    </div>
</div>

The current result is : https://i.sstatic.net/eABUX.jpg

I want to change the result to : https://i.sstatic.net/LOoVG.jpg

Also, I need it to be responsive. Thank you!

Answer №1

Update: If you are working with vanilla html/css or have the ability to modify your library-provided css:

To achieve the desired effect, make sure to include position: relative:

An element that is relatively positioned has a computed position value of relative. The top and bottom properties determine the vertical offset from its default position; while the left and right properties control the horizontal offset.

For a hands-on demonstration, check out this live example and snippet below:

section{
  display: inline-flex;
  flex-direction: column;
}

section img{
      border: 1px solid black;
}

#logo{
  top: 40px;
  margin: auto;
  position: relative;
}
<section>
  <div id="logo">
    <img src="https://picsum.photos/80/80" />
  </div>
<img src="https://picsum.photos/400/200/" />
</section>

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

Using Express.js to serve simple SVG files (Technique involving Cheerio.js)

My goal is to manipulate SVGs before sending them through Express.js. The code snippet I am using is as follows: app.get("/iconic/styles/:style/:base/:icon", function (req, res) { var style = req.params.style; var base = req.params.base; var i ...

Utilize jQuery to refresh the database with the information retrieved from the ajax-request

I am attempting to update the database. This is what I am doing From my JavaScript code var data = { "jobid": $('#jobid').val(), "names": $('#names').val(), "scripttype": $('#testscripts').val() }; var msg=""; f ...

The float right attribute doesn't stay contained within the box; instead, it drifts outside the box

I've been struggling to keep this box fixed at the top of the browser, but I'm facing an issue with the positioning on the right side. I can't seem to figure out how to solve it, so I'm reaching out for some help. #StickyBar #RightSide ...

Issue with sizing and panning when using a combination of Three.js and CSS3Renderer

This issue is specific to Chrome. Here's what I have experimented with: I am utilizing the webGL renderer to position a plane geometry in a 3D environment using threejs. This particular code is running within a class, with the scene as one of its me ...

Creating a functionality in jQuery, SQL, and .NET to generate a delete feature for removing specific IDs from the server

I am facing a challenge with my program that uses jQuery and .NET to generate IDs within a database. I want to implement a delete button where users can select the desired radial button containing the ID and click "delete" to remove it. Despite reading abo ...

Tips for troubleshooting grid display issues in Internet Explorer

.container{ display: grid; grid-template-columns: minmax(200px, 7fr) 4.4fr; grid-column-gap: 64px; } .item{ background: red; height: 100px; } <div class="container"> <div class='item item-1'></div> <div class=&a ...

Tips for successfully transferring large amounts of data using XmlHttpRequest in ajax calls

I'm facing an issue with passing a large amount of data to the controller using XmlHttpRequest. Here's the code snippet I've implemented: var xmlhttp; if (window.XMLHttpRequest) { xmlhttp = new XMLHttpRequest(); } else { xmlhttp = ...

Issue with jQuery datepicker not triggering onChangeMonthYear event

Recently, I've been working on creating an app using jQuery date picker. To see my progress so far, feel free to check out this fiddle: http://jsfiddle.net/Lf6sD/2/. In the options, there's a mention of an onChangeMonthYear event that should trig ...

Nested div within another div, shifting position relative to scrolling (React)

My goal is to create a unique effect where an object falls from the sky as the user scrolls down the page. The concept involves having the object div remain stationary in the center of its parent container, positioned 50 pixels from the top. However, when ...

checkbox toggling event triggering twice

I have been working on an application that allows users to register for university courses. They can select their registration type, course type, batch, and subjects. The subjects are displayed in a table based on the selected course type and batch. Users ...

Request queuing using jQuery with a time delay

I have a form that allows users to send messages on a forum. Using jQuery $.ajax post request, these messages are sent every 35 seconds as per the Security Policy Forum. In this form, I input the name of the user and the text for the message in the corres ...

The parent's height dynamically adjusts based on the height of its visible children using only CSS

I am dealing with the following structure: <div class="body"> <div class="wrapper"> <div class="dialog"> <div class="content-0"></div> <div class="content-1&quo ...

What are alternative methods for adjusting the value of a CSS property with alternative parameters?

When it comes to using similarities in my code, I often find myself needing a more flexible solution. For example: .position{ position:absolute; right:10px; top:20px; } This is where the idea of using a mixin comes in handy: .position(@absolute:ab ...

Techniques for Adding Background Color to Fieldset Border

Recently starting to learn HTML and stumbled upon a question: How can I create a background color or image for a field set border? Can I simply use regular color values, or do I need special codes for creating a background color in a field set? Any insig ...

Having Trouble with the Dropdown Submenu in Bootstrap

Could someone assist me in getting this dropdown menu to function properly? I am trying to make it so that when the "Program" menu is clicked, a dropdown submenu will appear. I have inserted some code for it, but unfortunately it's not working. Just t ...

Add a circular transition effect to Font Awesome icons

Check out my code snippet on JSFIDDLE: https://jsfiddle.net/8f3vLh0a/14/ I am using font awesome icons and I would like to add a circling effect on hover similar to this demo: http://tympanus.net/Tutorials/ResponsiveRetinaReadyMenu/ How can I implement t ...

Using jQuery to smoothly add a new item to the beginning of a group of items

Calling myself a semi-newbie when it comes to jQuery; still struggling with this... I have a bunch of items listed on a page, and my goal is to add a new item at the top of the list by (a) moving the existing items down and (b) smoothly fading in the new ...

Struggling with identifying errors in the Javascript code for my assignment

My code is giving me trouble and I could really use some assistance You can find my code in this GitHub folder: link. To see the project in action, visit this page on GitHub Pages: link. The task involves iterating over an array of names and printing eit ...

What is the best way to position the footer at the bottom of the page without obstructing any content?

I am currently working on a project that utilizes Bootstrap, and I am facing an issue with positioning the footer. Ideally, I want the footer to stay fixed at the bottom of the screen when there is not enough content to fill the page. However, when the con ...

Issue with page not updating after local storage change and returning to previous page

I have encountered an issue where in Firefox and Safari, the value retrieved from localstorage on the first page is not updated until I manually refresh the page after setting the localstorage value on the second page. Disabling the cache did not resolve t ...