Fixed first column in a spacious data grid

The layout I have created can be viewed in the Fiddle http://jsfiddle.net/5LN7U/.

<section class="container">
    <section class="field">
        <ul>
            <li> Question 1  </li>
            <li> question 2 </li>
            <li> question 3 </li>
            <li> question 4 </li>
            <li> question 5 </li>
            <li> question 6 </li>
            <li> question 7 </li>
        </ul>

    </section>
    <section class="datawrap">
        <section class="datawrapinner">
            <ul>
                <li><b>Answer 1 :</b></li>
                <li><b>Answer 2 :</b></li>
                <li><b>Answer 3 :</b></li>
                <li><b>Answer 4 :</b></li>
                <li><b>Answer 5 :</b></li>
                <li><b>Answer 6 :</b></li>
                <li><b>Answer 7 :</b></li>
            </ul>
        </section>
    </section>

</section>

This setup resembles a table constructed with div elements. The first column displays a list of questions, and the second column showcases answers or multiple answers that may require horizontal scrolling.

An issue I am encountering is that when I scroll down, the vertical scrollbar for the second column also moves downwards. What I desire is for the horizontal scrollbar to remain fixed in its position regardless of vertical scrolling.

I aim for a functionality similar to Google Spreadsheets, where the first column remains static while horizontal scrolling is enabled for other columns, accompanied by overall vertical scrolling for all content.

Unfortunately, utilizing a `position:fixed` property on the second column is not an option.

P.S: I have specific reasons for opting against using actual table elements for this structure.

Answer №1

Here is how you can accomplish this goal:

To achieve this, simply change the overflow-y:hidden; property in your CSS file for the .datawrap class to overflow-y: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

The custom attribute in jQuery does not seem to be functioning properly when used with the

I am currently working with a select type that includes custom attributes in the option tags. While I am able to retrieve the value, I am experiencing difficulty accessing the value of the custom attribute. Check out this Jsfiddle for reference: JSFIDDLE ...

Retrieve pairs of items from a given variable

Containing values in my 'getDuplicates' variable look like this: getDuplicates = 100,120,450,490,600,650, ... These represent pairs and ranges: Abegin,Aend,Bbegin,Bend My task is to loop through them in order to apply these ranges. var ge ...

ng-controller does not function properly when assigned a variable as its parameter

Every time I attempt to insert a variable into the ng-controller parameter, I receive the following error message: " Error: [ng:areq] Argument 'curController' is not a function, got string <div ng-include="templates[selected-1]" ng-cont ...

What is the best way to identify the type of an element using AngularJS?

Is it possible to use ng-model to identify the type of an element? For example: How can we determine if a specific element is a dropdown or a checkbox? HTML Code Snippet <select multiple ng-model='p.color'> <option value="red">Re ...

Spinning Wheel with Ajax in jQuery Mobile

When loading Ajax data for the next page, I am trying to display a spinning wheel. Interestingly, I can see the Ajax start and stop events in the console log, but the spinning wheels are not visible on the page! $(document).ajaxStart(function(){ conso ...

Contrasting outcomes between calling the await method in a function and directly logging the same method

My code consists of a for loop that iterates through an array. With each iteration, I intend for the loop to extract the value from a specified webpage and then display it in the console. for (let i = 0; i < jsonObjSplit.length; i++) { console ...

The sup tag does not function properly when used within the title tag

I added a sup tag inside a title tag but it doesn't seem to work. Surprisingly, the same sup tag works perfectly fine within li tags. Can anyone explain why this is happening? I tried changing the title tags to H class tags but I'm still curious ...

Move the text above within the footer using materialize framework

I'm facing an issue with my materialize footer's text disappearing when I set the height to 35px. Whenever I decrease the size of the footer, the text goes off the screen. How can I adjust it so that it stays visible? <footer style="positio ...

Using Vue Formulate to effortlessly upload multiple images

One of my projects involves using a Vue Formulate component for uploading multiple images to an Express.js backend. Here is the code snippet for the Vue Formulate component: <FormulateInput type="image" name="property_ ...

Updating the logo image on mobile devices using responsive CSS styling

My goal is to show a different image to users on mobile devices using only CSS, as I am unable to access the HTML code. On mobile, I used display:none for the header-logo-image img { and then added a background-url to the div to successfully display my alt ...

AngularJS testing typically involves the use of the inject module injection process

Currently, I am working on testing a service called documentViewer, which relies on another service named authService. angular .module('someModule') .service('documentViewer', DocumentViewer); /* @ngInject */ function Do ...

How to ensure NodeJS waits for a response before returning a value

I've come across a seemingly simple problem that I just can't seem to solve. My current project involves working with an asynchronous messaging bot. In this particular scenario, the bot is supposed to react to an event by calling a Restful API a ...

Sorting by two fields with varying value types in AngularJS

Need help sorting json data by two fields, prioritizing field value and then date. Check out this demo Json input [{ "title" : "Title 2", "pin" : false, "date" : 20130411204207 },{ "title" : "Title 3", "date" : 20140411204207 },{ "title" : "Title 4", ...

Why does tween animation appear instant rather than smooth?

I am trying to achieve a camera movement effect where the camera transitions from its current position to the center of a mesh (which is a sphere and I want to be inside of it) when a button is clicked. I have implemented a function with a tween for this ...

Different method for navigating in JavaScript

Currently, I'm in the process of developing a control panel using js and npm. I've run into an issue where I need to reset midway through the code without starting anew. Essentially, what I want is for the system to return to the menu after execu ...

Using Ajax with Laravel for Beginners

After clicking a button in my Laravel app, I want to update some data in the database using ajax without reloading the page. This is a simple ajax request where only a function in a controller needs to be invoked. I tried setting up the ajax request follo ...

What is the best approach to incorporating two distinct grid layouts within a single section?

I am attempting to replicate the header-graphic navigation found on this website: It appears that they are not using a grid for the header-graphic area, but rather keeping them separated as 2 divs within their Hero block container. I am interested in recr ...

`json object allows for category selection in options`

Hello (please excuse my English), I have the following script: <script type="text/javascript"> $(document).ready(function() { var idPlato = decodeURI(getUrlVars()["idPl"]); var url = "http://localhost/plato-datos.php?idPla="+idPl ...

Is it possible to use styled-components to specifically style a child class within a component?

Hey there, I'm currently working with a mui Badge component and am trying to customize the appearance of the small circle. This is what I have so far: const BadgeStyled = styled(Badge)` & > .muibadge-badge: { background-color: #d3d4d7; ...

What is causing lxml to not remove section tags?

Having some trouble parsing HTML using lxml and Python. My goal is to eliminate section tags, but seems like lxml can remove other specified tags except for sections. For instance: test_html = '<section> <header> Test header </header& ...