Table scroll with HTML and CSS

0 votes

I have a table like that which I fill with a data

<table id="products-table"  style="overflow-y:scroll" >
    <thead>
        <tr>
            <th>Product (Parent Product)</th> 
            <th>Associated Sites</th>
            <th>Actions</th>
        </tr>
    </thead>
    <tbody>
        @for (int i = 0; i < Model.Count(); i++)
        { 
        <tr>
            <td>
                <a href="Edit"><strong>@Model.ElementAt(i).Name</strong></a><br />
            </td>
            <td>
                <span class="lesser"></span>
            </td>
            <td>@Html.ActionLink("Edit Product", "Edit", "Products")<br />
                @Html.ActionLink("Associate Site", "Associate", "Products")
            </td>
         </tr>
        }
        <tr>
</tbody>
</table>

and CSS like that

    #products-table
{
     width: 200px;
    height: 400px;
    overflow:scroll;
}

but the scroll doesn't work, I want to fix the height of the table and if it exceeds, then work with the scrollbar

Aug 10 in HTML by Deepak
• 940 points
33 views

No answer to this question. Be the first to respond.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.

Related Questions In HTML

+1 vote
1 answer

How can i create simple register form using html and css?

Html5 contains lots of elements using which ...READ MORE

answered Jan 31, 2020 in HTML by Niroj
• 82,780 points
3,130 views
0 votes
0 answers

Transparent box or an image with HTML or CSS

I have no idea about creating a ...READ MORE

Jul 4 in HTML by Tejashwini
• 1,960 points
31 views
0 votes
0 answers

CSS to make HTML page footer stay at bottom of the page with a minimum height, but not overlap the page

I have the following page, which contains ...READ MORE

Jul 19 in HTML by Tejashwini
• 1,960 points
92 views
0 votes
0 answers

HTML table with fixed headers?

Can a large HTML table be displayed ...READ MORE

Jul 26 in HTML by Tejashwini
• 1,960 points
19 views
0 votes
0 answers

How to make a back-to-top button using CSS and HTML only?

I'm attempting to create a back-to-top button ...READ MORE

Aug 1 in HTML by Ashwini
• 1,160 points
17 views
0 votes
1 answer

How to perform a real time search and filter on a HTML table

Here is the best solution for searching ...READ MORE

answered Aug 4 in HTML by Deepak
• 940 points
44 views
0 votes
1 answer

Set cellpadding and cellspacing in CSS?

For controlling "cellpadding" in CSS, you can ...READ MORE

answered Jun 10 in CSS by Edureka
• 9,540 points
21 views
0 votes
0 answers

Set cellpadding and cellspacing in CSS?

In an HTML table, the cellpadding and ...READ MORE

Jun 8 in HTML by Ashwini
• 1,160 points
36 views
0 votes
0 answers

Table scroll with HTML and CSS

I have a table like that which ...READ MORE

Jul 8 in CSS by Edureka
• 11,040 points
213 views
0 votes
2 answers

Define a SQL query? What is the difference between SELECT and UPDATE Query? How do you use SQL in SAS?

HI.. SQL is Structured Query Language, which is ...READ MORE

answered Aug 8, 2020 in PHP by anonymous
4,980 views
webinar REGISTER FOR FREE WEBINAR X
Send OTP
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP