Interactive Image Carousel Using <ul> and <li> Tags

I am facing an issue with my image gallery slideshow using <ul> and <li> in HTML and CSS. The problem is that it is not responsive on mobile devices, as evidenced by the link provided herehere (I am accessing it from a smartphone).

In the image gallery, the images slide, fade away, and transition to the next image.

My query is: How can I make this slideshow responsive on mobile devices?

Code:

    .slides {
        padding: 0;
        width: 609px;
        height: 420px;
        display: block;
        margin: 0 auto;
        position: relative;
    }
    
    .slides * {
        user-select: none;
        -ms-user-select: none;
        -moz-user-select: none;
        -khtml-user-select: none;
        -webkit-user-select: none;
        -webkit-touch-callout: none;
    }
    
    .slides input { display: none; }
    
    .slide-container { display: block; }
    
    .slide {
        top: 0;
        opacity: 0;
        width: 609px;
        height: 420px;
        display: block;
        position: absolute;
    
        transform: scale(0);
    
        transition: all .7s ease-in-out;
    }
    
    .slide img {
        width: 100%;
        height: 100%;
    }
    
    .nav label {
        width: 200px;
        height: 100%;
        display: none;
        position: absolute;
    
      opacity: 0;
        z-index: 9;
        cursor: pointer;
    
        transition: opacity .2s;
    
        color: #FFF;
        font-size: 156pt;
        text-align: center;
        line-height: 380px;
        font-family: "Varela Round", sans-serif;
        background-color: rgba(255, 255, 255, .3);
        text-shadow: 0px 0px 15px rgb(119, 119, 119);
    }
    
    .slide:hover + .nav label { opacity: 0.5; }
    
    .nav label:hover { opacity: 1; }
    
    .nav .next { right: 0; }
    
    input:checked + .slide-container  .slide {
        opacity: 1;
    
        transform: scale(1);
    
        transition: opacity 1s ease-in-out;
    }
    
    input:checked + .slide-container .nav label { display: block; }
    
    .nav-dots {
    width: 100%;
    bottom: 9px;
    height: 11px;
    display: block;
    position: absolute;
    text-align: center;
    }
    
    .nav-dots .nav-dot {
    top: -5px;
    width: 11px;
    height: 11px;
    margin: 0 4px;
    position: relative;
    border-radius: 100%;
    display: inline-block;
    background-color: rgba(0, 0, 0, 0.6);
    }
    
    .nav-dots .nav-dot:hover {
    cursor: pointer;
    background-color: rgba(0, 0, 0, 0.8);
    }
    
    input#img-1:checked ~ .nav-dots label#img-dot-1,
    input#img-2:checked ~ .nav-dots label#img-dot-2,
    input#img-3:checked ~ .nav-dots label#img-dot-3,
    input#img-4:checked ~ .nav-dots label#img-dot-4,
    input#img-5:checked ~ .nav-dots label#img-dot-5,
    input#img-6:checked ~ .nav-dots label#img-dot-6,
    input#img-7:checked ~ .nav-dots label#img-dot-7,
    input#img-8:checked ~ .nav-dots label#img-dot-8,
    input#img-9:checked ~ .nav-dots label#img-dot-9,
    input#img-9:checked ~ .nav-dots label#img-dot-10 {
    background: rgba(0, 0, 0, 0.8);
    }

Can someone please assist me in addressing this issue? Any help would be greatly appreciated.


(Gist here)

Answer №1

In my opinion, you have the ability to make all the images in your code responsive simply by incorporating the code below to them (even without the need for CSS):

 <img src="example.jpg" style="max-width:100%;width:auto;height:auto;max-height:100%;">

Answer №2

I apologize for the inconvenience caused by my previous response not meeting your needs. I am always here to assist you. I believe that incorporating the following code snippet at the beginning of your code in the head section may resolve your issue:

<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.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

Determine whether the 'required' attribute in HTML5 is being enforced

Is there a simple way to check if a browser enforces the HTML5 required attribute when submitting a form? In other words, ensuring that the form cannot be submitted unless all required fields are filled in. Instead of adding modernizr just for this purpos ...

Challenges with border-color and CSS input:focus

The dilemma Currently, I am immersed in a project focusing on constructing a front end using bootstrap4. In order to align with the company's main color scheme, I decided to alter the highlighting color of inputs. To achieve this, I made the followi ...

Utilizing AJAX to dynamically update a div's content by extracting a specific div from the retrieved data

Although I believe my code is correct, I am not very familiar with AJAX and have been struggling for hours to get it right. I've tried various approaches, including using filters, but nothing seems to work. The issue I'm facing is that the chat m ...

Executing PHP code discreetly

Alright, I currently have a php script located at for creating a new user. What I typically do is send the user data via POST to add it to the MySQL database and then send an email to the user for account verification. However, due to the slow SMTP serv ...

Embedding a CSS file into a PHP class

I've encountered a little issue that I can't seem to solve on my own. I've put together a "webengine" using multiple classes. The primary class responsible for obtaining a theme's internals is called "Logic". This Logic class contain ...

How about designing a menu that changes based on user interaction?

After searching extensively on Stack Overflow and Google, I still haven't found the answer I'm looking for, so please don't be mad at me! :) On an HTML page utilizing ASP .NET 4.5, what type should I use for a link menu? I want to create a ...

What is the best way to display a loading screen while simultaneously making calls to multiple APIs?

I'm currently working with Angular 8 to develop an application that retrieves responses from various APIs for users. The application is designed to simultaneously call multiple APIs and I require a loading indicator that stops once each API delivers a ...

The <br/> tag is not functioning properly when retrieving text from a MySQL query

Currently, I am involved in a project that involves an A.I pushing text onto a MySQL database. Our goal is to display the ongoing writing process on a webpage. We are still actively working on this. We are retrieving the data and regularly checking the da ...

Transform your CSS3 rotateY into PHP Imagick::distortImage

I'm trying to rotate an image by rotateY(-54deg) on the front-end, and now I need to achieve the same rotation in PHP using Imagick::distortImage. $image->distortImage(Imagick::DISTORTION_PERSPECTIVE, $controlPoints, true); Is there a straightfor ...

Retrieve the HTML tag content as a string using jQuery

For my OSINT project, I am developing a tool that needs to extract text from a specific HTML code string. $("p").text(); I'm looking for a way to make my variable work with the above code. Any suggestions? Share your ideas! Solution: $.ajax({ ...

I envision my home page being divided into two visually stunning full-screen sections, each taking up the entire height of the page

I am currently working with the code shown below. It successfully displays the first part in full height, regardless of resolution, but once I scroll to the second half, there is a large empty gap. How can I eliminate this gap and make the transition smoot ...

Looking to add a dynamic divider between two columns that can be adjusted in width by moving the mouse left and right?

If you're looking for an example of two columns adjusting their width based on mouse movement, check out this page from W3Schools. I'm trying to implement this feature in my React app, but I'm unsure of how to proceed. Below is the JSX code ...

How to smoothly transition a div from one location to another using animations in an Ionic3-Angular4 application

I'm attempting to incorporate some animation into my Ionic 3 mobile app. Specifically, I want to shift a div from one location to another. In the code snippet provided below, I am looking to move the div with the "upper" class after the timeline-item ...

Adjusting the screen width to activate a responsive nav bar with a centered title

I'm facing an issue with the alignment of the heading within a navigation bar, causing the links to wrap before the collapse of the nav-bar occurs - https://i.sstatic.net/bKyPM.png I am trying to make the links collapse earlier than they currently d ...

Designing a Curved Stepper Component in the Shape of an S

I've been attempting to create a custom stepper component with an S-curve shape using React, but so far I haven't been successful. I even tried utilizing the MUI Stepper component and experimented with pure HTML and CSS, but couldn't achieve ...

What is preventing the click function on a dynamically created button from being executed in jQuery?

Take a look at this jsFiddle where I illustrate my issue. Whenever I click on the "Add an ingredient" button, the button click event is triggered. My issue arises when I click on the "Create a subtitle" button because it dynamically creates "Add an ingredi ...

I require help with my digital greeting card

Apologies for any language errors in advance. I'm almost done with my first "online-card" project, but I've hit a frustrating issue. I can't seem to remove the gap between the footer and the tab-content (the Hungarian version is fine). I&apo ...

Struggling to get image properly aligned using touch gestures

Currently, I am struggling with the task of centering my image based on the touch input that will drag it. For example, if the user touches the top right corner of the image, I want the image to automatically move so that its center aligns with that touch ...

What could be causing the list-group and list-group-item classes to not take effect in this situation

Currently diving into Bootstrap 5, I decided to play around with lists. Here is a snippet of the code I'm working with: <ul class="list-group"> <li class="list-group-item">Cras justo odio</li> <li class="l ...

The pop-up in the navigation bar imported from another source is malfunctioning

I'm in the process of constructing a website with a navigation bar that I'm importing from another HTML file, like this: Navbar HTML <nav class="navbar fixed-top navbar-expand-lg bg-dark navbar-dark"> <a class="navbar-brand" href="in ...