Creating a responsive carousel that is not yet designed

As a beginner, I'm facing what seems like a simple problem that I just can't solve. Here is the HTML code I've written:

<div class="discs container">
    <ul>
        <li><div class="arrowleft"><a href="#" ></a></div></li>
        <li><a href="#" ></a></li>
        <li><a href="#" ></a></li>
        <li><a href="#" ></a></li>
        <li><a href="#" ></a></li>
        <li><a href="#" ></a></li>
        <li><a href="#" ></a></li>
        <li><a href="#" ></a></li>
        <li><div class="arrowright"><a href="#" ></a></div></li>
    </ul>
</div>

I also have the following CSS:

.container {width: 960px; margin: 0 auto;}
.discs {
padding: 16px 0 16px 0;
border-bottom: 1px solid transparent;
outline: 1px solid #333333;
}

/* Remaining CSS properties */

Despite my attempts with using em's for sizes and margins, the layout jumps around when I scale the webpage. How can I make it responsive?

EDIT: You can view a demo of the issue on this JSFiddle link.

Answer №1

Hey, it's best practice not to use pixels (px) for width and other style properties. Instead, try using percentages (%) for a more responsive design.

.box {width: 70%; margin: 0 auto;}

Answer №2

 @media only screen and (max-width: 767px)

This method allows you to customize your CSS according to the specific screen resolutions you are targeting.

Answer №3

By setting a fixed width of 960px on your container, it prevents it from collapsing. Consider using a percentage value instead:

.container{
    width : 80% ;
    margin : 0 auto;
}

This way, the carousel will adjust to be 80% of the screen size. You may also want to explore Twitter Bootstrap for a responsive carousel solution that is already built-in.

Check out Twitter Bootstrap Carousel here

Answer №4

I made a few adjustments to your .discs ul class. Hopefully, this aligns more with what you had in mind:

.discs ul {
    padding: 0;
    height:120px; /*adjust the height as needed */
    overflow:auto;
}

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

Next.js file communication issue with data transfer

There are three files here: project.js import Image from 'next/image'; import Link from 'next/link' import { DATA } from '../../components/Data' const WEB_RELATED = [] const PC_EXES = [] for(let i=0;i<DATA.length; i++){ ...

- Challenges with internal systems

I have a dialog window where I want to display a confirm dialog when clicking Cancel. To achieve this, I am creating a div element with some text that should be shown in the confirm dialog. However, the issue I'm facing is that the text intended for t ...

Prevent table headers from scrolling in Bootstrap Vue by following these steps

Just starting out with bootstrap vue and I've been using version 1.4 for my application. I've utilized b-table for displaying my data, but I'm encountering a problem where the table headers also scroll along with the content. I'd like t ...

Where is the best location to store the image files?

I am currently working on a web application that focuses on Image processing, however I have encountered a basic issue. The images are not loading during the runtime of my HTML page. I have tried placing the image files in the src folder, but it seems li ...

Attempting to change the background color of a table row when hovering in React, but experiencing no success

Describing the appearance of my table row: <tr onMouseEnter={() => {this.buttonIsHovered = true} } onMouseLeave={() => {this.buttonIsHovered = false}} className={this.buttonIsHovered ? 'hover' : null}> The initial value ...

Need inspiration for testing web content with Protractor?

Exploring new possibilities for testing web content with Protractor. Any fresh ideas on what else can be tested? So far, I've checked links to ensure they redirect correctly. I've also verified text color and decoration changes when hovering ove ...

css code for styling html elements

HTML: <link rel="stylesheet" type="text/css" href="styles.css"><table border="0" cellpadding="0" cellspacing="0" class="month"> <tr><th colspan="7" class="month">January 2017</th></tr> <tr><th class="mon">Mo ...

Executing a Python script within an HTML page using Django and extracting a variable from an input form

I have created a sentiment analysis Python script, but now I want to integrate it with an HTML page. The goal is to take input from the HTML form, process it using the Python script, and then display the results back on the HTML page. Currently, I am usin ...

"Text that appears on a clear background when you hover over it

I'm attempting to have hidden text display inside a table cell upon hovering. I managed to achieve the hidden-until-hovered effect, but I am struggling to make the text appear solid in color (it currently decreases in opacity when hovered over). Is th ...

Listening to a variety of MP3 files

Last weekend, my dad asked me to transfer a few CDs to his digital library so he can listen to them anywhere. I was thinking of hosting the MP3 files on my server and creating a script that displays all the music files. He could then select one or multiple ...

What is the best way to showcase information in Angular?

I am facing an issue where my cards are not displaying data from the database, they appear empty. Can anyone provide a solution to help me fix this problem? Below is the output I am getting, with the empty cards that I want to populate with data. MY TS: l ...

Make the button appearance change when being clicked different from when being hovered over

I'm trying to create a button that changes background color when hovered over, but maintains the button color without a background color when clicked. This is what my current code looks like: .windowButton:hover { background-color:#1a82b8; } .win ...

An inexplicable right margin

I am facing an issue with centering a table (a tracklist) under the album cover and title. There seems to be an unexpected margin on the right side that I can't seem to figure out. Any help in identifying the cause of this issue would be greatly appre ...

Is there a way to prevent the context menu from appearing when tapping on an image on a mobile phone?

When attempting to move an image on the screen with a touch event, a popup appears in Chrome when pressing and holding the image. This popup usually includes options to save the image. Is there a way to disable this popup so I can freely move the image w ...

Ways to expand the dimensions of a Popup while including text

I am using a bootstrap modal popup that contains a Treeview control in the body. The issue arises when the node's text width exceeds the popup's width, causing the text to overflow outside of the popup. Is there a way to dynamically adjust the ...

Having trouble loading CSS and JavaScript files in CodeIgniter?

In my project, I am utilizing Bootstrap as a template. However, when attempting to access Bootstrap in Codeigniter, the page fails to load the CSS and JavaScript files. I have included the URL in autoload.php $autoload['helper'] = array('url ...

The local HTTP server is having trouble establishing a connection with the Firebase user

Utilizing Visual Studio Code editor and a node js HTTP server, I have developed a simple login page and created a user in firebase. However, I encountered an issue with logging in using the username. The code for the webpage was written in HTML and bootstr ...

What causes HTML/Django template to run code in a non-linear fashion?

I was puzzled by the behavior of this particular html template I learned in an online class. It seemed to be executing out of order: The python form class is called using Django's syntax {{form}} which injects blank fields for user input (name, email ...

Switching my Bootstrap navbar to a Right-to-Left layout

Currently working on creating a navbar that needs to go from Right to Left for Hebrew language compatibility. Experimenting with a responsive navbar layout where the linked buttons align on the Left and move towards the Right. Want to have the brand logo ...

String casting for large JavaScript integers may require rounding to function properly

When trying to pass a large integer to a function from an onclick event in HTML, I always encounter issues with rounding. Despite using bigInt libraries, I still struggle to pass the full number accurately and would prefer a simple string casting method. ...