Build an HTML table with immovable side columns on both the left and right sides

Currently facing a dilemma here. I developed a booking system for a client and didn't prioritize making it responsive. However, the need for responsiveness arose last week. I thought my code was prepared for this, but turns out it's not as responsive as needed. The goal for mobile and tablets is to keep the left and right columns fixed while allowing scrolling/swiping for the ones in between.

You can take a look at the development link here: example

As shown in the example, the very left column displays booking information, and the far right column contains the proceed button. These are the columns that should remain fixed. Is there a way to achieve this using CSS only? I have a lot of JavaScript already implemented and would like to exhaust all CSS options before turning to more scripting.

Any assistance on this matter would be highly appreciated.

EDIT I've managed to add a set width to the first and last columns using:

td:first-child
td:last-child{
    width:120px;
}

This is a good start, but the middle columns become squished on smaller screens, affecting usability and readability. I'm aiming for some kind of horizontal overflow to enable users to scroll or swipe on mobile and tablet devices.

Answer №1

Include a fixed width or minimum width (if it can exceed but not fall below the specified value) for the first and last column.

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

Explore a JSON structure by clicking on a link using AngularJS

I am looking to develop a library in AngularJS that includes dropdown menus for selecting a book and then choosing a chapter from that book. Once a chapter is selected, the corresponding text should be displayed. All book data is available in a single JSON ...

Struggling to populate dropdown with values from array of objects

My issue is related to displaying mock data in a dropdown using the SUIR dropdown component. mock.onGet("/slotIds").reply(200, { data: { slotIds: [{ id: 1 }, { id: 2 }, { id: 3 }] } }); I'm fetching and updating state with the data: const ...

Handling AJAX requests in ASP.NET for efficient communication

I'm in the process of setting up ajax communication between a JavaScript frontend and an ASP.NET backend. While researching, I came across this sample code on w3schools: function loadDoc() { var xhttp = new XMLHttpRequest(); xhttp.onreadystatecha ...

What is the best way to activate CSS keyframe animation depending on the scroll location?

My goal is to create a circle animation that fades in based on the user's scroll position. As the user scrolls down, the circle grows larger, and as they scroll up, it shrinks. The animation will pause when the user stops scrolling, requiring them to ...

Unable to call Success function in JQuery AJAX request

Here is a simple JQuery ajax request I am working on: $.ajax("../ajax/data/items.json", { success: setContent, type: "GET", dataType: "json" }); function setContent(data, status, jqxhr) { alert("Hello!"); } The json file loads successfully with a 200 r ...

What steps should I take to ensure that this 3D transformation functions properly in Internet Explorer 10?

I'm struggling to get a CSS 3D transform to function properly in IE10. The issue arises because IE10 lacks support for the preserve-3d property. According to Microsoft, there is a workaround available. They suggest applying the transform(s) of the pa ...

Utilizing the zIndex property in webGL programming

I am currently working on a three.js program My main goal is to display a 2D panel in front of the three.js scene for debugging purposes. I plan to achieve this by creating a div element and adjusting its z-index to show it above the three.js canvas. Un ...

What could be the reason my post method is not reaching the controller?

Struggling to send a basic model back to the controller for updating an object. Can't seem to figure it out. The Controller method: [Authorize(Roles = Enums.Roles.SiteAdmin)] [HttpPost] [ValidateAntiForgeryToken] public ActionResult ...

Why does the implementation of my interface differ from what is specified in the TypeScript documentation?

Currently delving into the world of TypeScript documentation https://www.typescriptlang.org/docs/handbook/2/classes.html Specifically focusing on the section implements Clauses, an interesting revelation surfaces: A Word of Caution It’s worth noting t ...

Transferring a JavaScript variable to PHP through AJAX

I am struggling to pass a JavaScript variable from index.php to response.php. Despite my efforts, I can't seem to get any output. As a JavaScript and AJAX novice, I'm not sure what I'm missing. Can you please point out any mistakes in the fo ...

I am working on an HTML form that is designed vertically, but I am unsure of how to arrange two text fields side by side on the same line

I'm struggling with formatting my HTML form to have two text fields on the same line instead of stacked vertically. In the example below, I want the Size, Width, and Height fields to be aligned horizontally rather than one below the other. <form c ...

Upon refreshing the page, the fancybox appears without the need for clicking

After spending countless hours sifting through blogs, code snippets, and forums, I am still struggling to solve this issue. My goal is simple: display a thumbnail image on a webpage along with a summary of information. Upon clicking the thumbnail, I want ...

How can I apply multiple backgrounds to a SVG object?

I am in the process of converting an HTML element into an SVG object. I have made progress, but there is one thing that I am stuck on: I'm having trouble figuring out how to define multiple backgrounds in SVG, specifically when it comes to converting ...

Winning opportunities created by using credits in the slot machine

**Greetings, I have created a slot machine using JavaScript, but I am looking to enhance the player's chances based on their credits. Can anyone guide me on how to achieve this? Essentially, I want the player's odds to increase proportionally wit ...

Prevent the sidebar from collapsing or disappearing when the viewport is less than 768px in Bootstrap

Utilizing the Bootstrap classes side-nav and nav-sidebar, I have created a side navigation bar. However, there is an issue - when the viewport is less than 768px, the side navigation bar disappears. Below is the snippet of my HTML code: <ul class="nav ...

When an object is created, what is the most effective way to manage the asynchronous setup of one of its properties?

This is my first attempt at creating a JavaScript module/library, so I'm feeling a bit out of my depth. I apologize for not knowing exactly what to search for. My goal is to develop a library that stores information from a user-provided URL. The func ...

Highlighting n-grams in a contenteditable div

My query does not pertain to extracting n-grams, but rather focuses on highlighting 1/2/3/4 grams within a content editable div. I have a div with some text in it. The n-grams are retrieved from the backend and should be highlighted within the div. I am a ...

Using AngularJS to access the properties of a header within a $http request

As I navigate through the github API's pagination documentation, I am attempting to retrieve event items and extract the Link header (as recommended) in order to construct the pagination. However, I am facing difficulty in understanding how to work wi ...

Prevent dropdown from closing when clicking inside components [react-bootstrap]

I am searching for a solution to hide a drop-down bot by clicking on elements inside it. I am exploring different methods using JQuery. Is it possible to achieve this using JavaScript in combination with react-bootstrap? My current approach involves calli ...

What is the best way to incorporate multiple pages into a Node JS and Express application?

After completing a tutorial on Node JS for RPI (https://www.youtube.com/watch?v=QdHvS0D1zAI), I encountered an issue when trying to add multiple websites to my web app. While everything works fine locally on localhost:5000/page2, once I make the app public ...