HTML content that does not allow scrolling and includes headers for tables

I am in need of an HTML page that includes a header and a table with a non-scrollable feature. The scroll should only be available for the contents within the table.

For example:

<html>
    <body>
        <h1>header</h1>
        <h1>header2</h1>
        <table>
            <thead>
                <tr>
                    <th>name</th>
                </tr>
                <tr>
                    <th>address</th>
                </tr>
            </thead>

            <tbody>
                <tr>
                    <td>Venkat</td>
                </tr>
                <tr>
                    <td>bangalore</td>
                </tr>
                //this part will be repeating
            </tbody>
        </table>
    </body>
</html>

I specifically want the content in the table body to be the only part that is scrollable.

I have looked at other resources such as How do you create non scrolling div at the top of an HTML page without two sets of scroll bars

However, I am unable to use a div to contain just headers and a table header..

I have created a fiddle with a similar situation to mine. Feel free to check it out http://jsfiddle.net/VenkateshManohar/bU7NN/

Answer №1

If you're looking for a solution, check out this jQuery plugin here - it will handle it all for you!

Answer №2

If you want to achieve this, you can follow these steps: LINK

Here is the HTML Code snippet:

<div class="dataGridHeader">
  <div class="dataGridContent">
    <table cellpadding="0" cellspacing="0" class="scrolltablestyle style-even">
      <thead>
        <tr>
          <th width="160">Shopper Name</th>
          <th width="160">First Name</th>
          <th width="160">Last Name</th>
          <th width="160">User ID</th>
          <th width="160">Status</th>
        </tr>
      </thead>
      <tbody>
        <tr>
          <td width="160">C2C Fishing</td>
          <td width="160">John</td>
          <td width="160">Doe</td>
          <td width="160">C2C Fishing</td>
          <td width="160">Enabled</td>
        </tr>

.
.
.
.
      </tbody>
    </table>
  </div>
</div>

I trust this information will be useful for your needs.

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

Is there a way for me to include the input into the link within the action of a search bar?

As I work on my HTML script to create a search bar, I've run into an issue. Currently, the page redirects to instead of the input in the search box. For example, if the input in the search box is "icecreamshop", I want it to redirect to <form a ...

When a child element within a flex container has a relative position, the flex direction column will be overridden and

I'm having trouble with the code snippet below. For the .container, I have set display:flex; flex-direction: column; in order to position my previous and next arrows before and after the container items. However, the flex direction does not change ...

Tips for enclosing the "body" element using a background image

Hey there! I'm a newbie web developer with a casual approach to coding. I'm trying to jazz up my menu by adding a background image, but no matter what I do, it keeps showing the default white background. Can anyone lend me a hand? If you're ...

Display the percentage text behind a filling Bootstrap progress bar

I'm working on a bootstrap progress bar that displays a percentage along with the numerical value. Currently, the text fits next to the progress bar up until around 85%, after which it blocks the bar from growing further. You can see the issue in the ...

Use jQuery to create a price filter that dynamically sets slide values based on the filter object

I'm currently utilizing the jQuery slide filter to sort products based on price. The filtering value is set within the script, but I am interested in dynamically setting it based on the highest/lowest number found on my page using a data attribute. D ...

Display text with ellipsis on one of the two spans within a container

I'm struggling with implementing ellipsis in my HTML code. Here's what I have: <div id="wrapper"> <span id="firstText">This text should be displayed with an ellipsis</span> <span id="lastText">this text should not ...

Mastering the art of customizing jQuery Mobile skins

Just landed a front end developer role at a prominent bank where I'll be focusing on the UI using jQuery Mobile. I'm looking for a comprehensive page that contains all the assets of jQuery Mobile to streamline the skinning process. Any leads? ...

Issues persist while attempting to save sass (.scss) files using Atom on a Mac

When attempting to work with sass files, I encountered an error message every time I tried to save the file: Command failed: sass "/Users/bechara/Desktop/<path of the file>/test.scss" "/Users/bechara/Desktop/<path of the file>/test.css" Errno: ...

The font size on my website fluctuates up and down every time I refresh the page or navigate to a different one

I am currently in the process of updating my research lab's website using a Jekyll framework with Bootstrap. However, I have encountered an issue where the font size grows slightly whenever I navigate to a new page or refresh the current one, before r ...

Creating a webpage with a layout that features three full-length columns using

body { background-color: blueviolet; } .leftcolumn { width: 30%; height: 100%; float: left; background-color: brown; } .middlecolumn { float: left; background-color: yellowgreen; width: 60%; height: 100%; } <body> <div class= ...

"Filtering and extracting particular form elements to be sent to the $_POST superglobal array

Currently, I have a table filled with data that is editable by administrators. There is a submit button to apply all changes, but I am interested in knowing if it is possible to only send the data that has been modified. One idea is to add a checkbox that ...

Unable to specify the width for a DIV element

I am in the process of creating a gaming website and have encountered an issue with setting the size of the genre menu using the DIV tag. Below is a snippet of the HTML code I am using: <div class="center"> <div class="menu" onclick="loc ...

The art of positioning Bootstrap popovers

Does anyone know a way to position a bootstrap popover on the "Right Bottom" of a clicked button instead of the "Right Middle"? The positioning should be dynamic. https://i.sstatic.net/OSQln.png To see the standard code, click here: http://jsfiddle.net/V ...

Loop through an array of div IDs and update their CSS styles individually

How can I iterate through an array of Div IDs and change their CSS (background color) one after the other instead of all at once? I have tried looping through the array, but the CSS is applied simultaneously to all the divs. Any tips on how to delay the ...

What strategies can be employed to troubleshoot CSS design problems that exclusively occur in the production environment?

My Node.js based URL shortening project can be found on GitHub at this link. It's deployed on Vercel, but I've been experiencing some CSS design discrepancies on the Pixel 7 device while using the Brave browser. Specifically, I'm having issu ...

What is the best way to increase padding beyond p-5 for specific screen sizes?

I need help creating a webpage that is responsive in design. Below is a snippet of the specific section I am working on: <div class="container-fluid"> <div class="row p-3 p-lg-5"> <div class="col"&g ...

Are HTML attribute names really case-sensitive? A topic filled with conflicting information

After learning that attribute names are case-sensitive, I found conflicting information. A source mentioned that attribute names are indeed case-sensitive. For example, the width attributes in <div> and <DIV> would be considered separate due ...

Using Typescript in React to render font colors with specific styling

Attempting to utilize a variable to set the font color within a react component, encountering an error with my <span>: Type '{ style: "color:yellow"; }' is not assignable to type 'HTMLProps<HTMLSpanElement>' The use of yel ...

How can I activate a jQuery function only when it is within the viewport?

I have installed a jQuery Counter on my website, but I am experiencing an issue where the counter starts or finishes before reaching the section where the HTML code is embedded. Any assistance with this problem would be greatly appreciated! <script& ...

What could possibly be causing the "Unexpected token (" error to appear in this code?

Sorry if this appears as a typo that I am struggling to identify. My browser (Chrome) is highlighting the following line <a class="carousel-link" onclick="function(){jQuery('#coffee-modal').modal('show');}">Book a coffee</a> ...