Is there a way to ensure a table created with CSS display: table adheres to a specified minimum height?

Using display: table, display: table-row and display: table-cell, I am dealing with a large number of rows in a table and utilizing AngularJS ng-repeat to populate them. Although the example shows just two rows, in reality there are many more that all need to fit within a height of 10rem.

<div style=height: 10rem>
 <div style="display: table">
  <div style="display: table-row">
      <div style="display: table-cell">
      xxx
      </div>
      <div style="display: table-cell">
      xxx
      </div>
  </div>
  <div style="display: table-row">
      <div style="display: table-cell">
      xxx
      </div>
      <div style="display: table-cell">
      xxx
      </div>
  </div>
 </div>
</div>

The goal is to constrain the table's height and show a scroll bar on the right side, but attempts to make it fit within a <div> with a set height have been unsuccessful.

If anyone can offer guidance on how to limit the table height and display vertical and horizontal scroll bars, it would be greatly appreciated.

Answer №1

To ensure proper scrolling functionality, apply overflow-x: scroll (or auto) to the container that has a height of 10rem. Also, add overflow-x: visible to the table element itself.

It's important to note that quotation marks should be included in the first line as shown below:

<div style="height: 10rem">

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

Limiting the size of textboxes in Twitter Bootstrap

I am currently working with bootstrap text boxes in the following manner: <div class="row"> <div class="col-lg-4"> <p> <label>Contact List</label> <select class="form-control" id="list" name="li ...

Strange Safari 15 bug causing unexpected transformations

Hey there, I'm a div with animation on scroll using GSAP. On Safari 15 (no issues below 15), something strange is happening - parts of the letters are leaving an afterimage on the sides. The code snippet I am using for this animation is: this.$refs.l ...

Navigating through Switch cases and If Statements with multiple arguments can be complex for beginners in the world of JavaScript

Hi there, I have a specific case that I'm struggling to find a solution for. I am using Angular with a Firebase back-end to retrieve true or false values from a variable called ref. The variable contains 4 properties with either true or false values - ...

Retrieving information from a database by employing AngularJS with the assistance of PHP

I am a beginner in using AngularJS and I am trying to retrieve data from a database using PHP. Here is the code I have tried: <html> <head> <script src = "http://ajax.googleapis.com/ajax/libs/angularjs/1.2 ...

What are the steps to submit a Textbox form?

My current setup includes a search box and a button that users click to execute the search. However, I am looking to enhance the functionality by allowing users to press "enter" instead of clicking the search button. How can I achieve this modification? B ...

Creating image galleries with HTML and Javascript loop through the drawImage function to display multiple

I'm currently working on developing a card game using HTML5 canvas, and I've come across an issue with the drawImage function when used inside a loop. It seems like there might be a problem related to closures, but I'm not entirely sure how ...

The ability to scroll horizontally for individual items within a larger container div

JSFIDDLE: http://jsfiddle.net/7zk1bbs2/ If you take a look at the JSFiddle project, you'll notice that the icons are placed inside an orange box. However, there is a vertical scroll needed to browse through them and I am attempting to enable horizont ...

Tips for sending a JavaScript variable within a div's ID in a Twig loop?

How can I insert a JavaScript variable into the ID of a div inside a Twig loop? Here is my unsuccessful attempt: <script type="text/javascript"> id = 0; </script> {% for element in parent.elements %} <div id="mydiv"> ...

Modify the CSS of one div when hovering over a separate div

I've been working on a simple JavaScript drop-down menu, and it's been functioning correctly except for one issue. When I move the mouse out of the div that shows the drop-down menu, it loses its background color. I want the link to remain active ...

I am struggling to properly align the login form in the center of the login page

Can someone please assist me in centering the login form on the login page? I've attempted using align-items-center and justify-content-center but it's still aligning at the top. Any help would be greatly appreciated as I've spent a signific ...

Can you explain the purpose of the URL function in the context of url("#foobar"

Currently, I am developing a CSS concatenator and one of the tasks involved is URL to absolute URL rewriting. For this process, I exclude any absolute URLs that start with http, https, etc. In the case of Django projects, they designate the following URL ...

Discover the process of utilizing doc.getElementbyClassName to determine if any of its elements are blank

On my HTML invoice table, I sometimes have empty elements that cause the row to misalign. To fix this, I want to add whitespace if an element is empty. Here is the structure of the table: <div class="invoiceTable"> <div class="titles2" style=" ...

Why is this chip-list not functioning properly in my Angular 14 and Angular material application?

I'm currently developing a form using Angular 14. My goal is to incorporate a field with Angular Material chips. Within the component's Typescript file, I have the following code: constructor(private fb: FormBuilder,) { } public visible: boole ...

"Encountering a Challenge with Setting Up Forms on

I've recently started learning to code and I'm facing an issue with my form appearing stretched out. You can view it here: I initially thought it was due to margins, so I increased them. Then, I tried adjusting the width to 50%, but that didn&ap ...

Is there a way to showcase a block of Python code using a combination of HTML, CSS, and Javascript to enhance its

On my website, I want to display code blocks similar to how StackOverflow does it. The code block should be properly colored, formatted, and spaced out for better readability. All the code blocks on my site will be in python. def func(A): result = 0 ...

AngularJS select box plugin exclusive to use

Which select box for Angular is recommended without relying on jQuery? I have come across many select boxes using jQuery, but this time I am working solely with Angular. Appreciate the insight! ...

Scrolling presentation with dynamic animations

Does anyone have any suggestions for creating a scrolling effect similar to the one on this website? I want to implement a scroll effect where each presentation page is revealed one by one when the user scrolls using their mouse wheel, encouraging them to ...

Problem with (click) event not triggering in innerHtml content in Angular 4

For some reason, my function isn't triggered when I click the <a... tag. Inside my component, I have the following code: public htmlstr: string; public idUser:number; this.idUser = 1; this.htmlstr = `<a (click)="delete(idUser)">${idUser}&l ...

The section cannot be shown in a flex layout within a grid container

My goal is to showcase a grid layout containing multiple sections within a div, but I'm encountering an issue where the sections are only displaying as blocks. I am seeking assistance in making the second portion of the data appear flexed. Currently, ...

Struggling to develop a Singleton AngularJS Service?

I am in the process of creating a Singleton AngularJS service using the 4th method. The structure of my service is as follows: provider('SocketService', { socket: null, // methods used within the config() of a module connect: functi ...