The behavior of rowspan at the bottom of the table is showing unique characteristics

I have encountered an issue with a simple table that I created using HTML and Bootstrap. The last rowspan feature did not behave as expected. Here is the code snippet:

https://i.sstatic.net/Mz82q.png

The intention was to merge 4 cells marked in red into one, so I replaced the first <td>group1</td> with

<td rowspan="4">group1</td>
and removed the remaining 3 <td>group1</td>, but this resulted in messing up the entire table layout.

Although it is placed within the

<div class="col-lg-7 mb-4">
division, I also experimented without any division, yielding the same outcome. I am unsure about the root cause of this problem, especially since the other rowspans are functioning properly.

/* CSS styling (optional): */

table.table-bordered {
  border: 1px solid #2f8dff!important;
  box-shadow: 0px 0px 100px 0px #2f8dff;
  margin-top: 20px;
  text-transform: uppercase;
  font-size: 12px;
  color: white;
}

table.table-bordered>thead>tr>th {
  border: 1px solid #2f8dff!important;
}

table.table-bordered>tbody>tr>td {
  border: 1px solid #2f8dff!important;
}
<table class="table table-bordered">
  <thead>
    <tr>
      <th></th>
      <th>mon</th>
      <th>tue</th>
      <th>wed</th>
      <th>thu</th>
      <th>fri</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td rowspan="2">17:00-18:00</td>
      <td>1</td>
      <td>2</td>
      <td>3</td>
      <td>4</td>
      <td>5</td>
    </tr>
    <tr>
      <td>6</td>
      <td>7</td>
      <td>8</td>
      <td>9</td>
      <td>10</td>
    </tr>
    <tr>
      <td rowspan="2">18:00-19:00</td>
      <td>1</td>
      <td rowspan="2">group3</td>
      <td>3</td>
      <td>4</td>
      <td rowspan="2">group3</td>
    </tr>
    <tr>
      <td rowspan="2">group2</td>
      <td>8</td>
      <td rowspan="2">group2</td>
    </tr>
    <tr>
      <td rowspan="2">19:00-20:00</td>
      <td rowspan="4">group1</td>
      <td rowspan="2">group1</td>
      <td>group1</td>
    </tr>
    <tr>
      <td rowspan="3">group1</td>

      <td rowspan="3">group1</td>
      <td>group1</td>
    </tr>
    <tr>
      <td rowspan="2">20:00-21:00</td>
      <td>3</td>

      <td>group1</td>
    </tr>
    <tr>
      <td>7</td>

      <td>group1</td>
    </tr>
  </tbody>
</table>

Any suggestions on how to address this issue would be greatly appreciated! Thanks!

Answer №1

I'm not entirely sure what you mean by the table being "messed up". When I added the row-span="4" and removed the three td tags that followed, the table appeared to be perfectly fine from my perspective:

https://i.sstatic.net/fBSB0.png

The only issue I noticed was the varying height of one particular table cell. To address this, you can add the following CSS code:

tr {
    height: 1rem;
}

This will ensure that each row has an equal height, resulting in a more uniform appearance like so:

https://i.sstatic.net/dbqnO.png

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

Implementing jquery-confirm in CodeIgniter: A Step-by-Step Guide

I'm having some trouble with the jquery-confirm plugin from . Everything seems to be working fine, but when I try to delete an item, the jquery pops up an alert. However, when I click "okay", it doesn't actually delete the item. I can't figu ...

Prevent body width from exceeding the size of the screen

Having some trouble setting up my CSS here. The body size seems to be larger than the screen size, causing everything else to be slightly misaligned. I've already experimented with using width 100% and 100vw, but the issue persists. As you can see in ...

PHP code does not involve inputting data into a database table

I've hit a roadblock while trying to input form data into a database table. Despite following various tutorials, I haven't been successful so far. Can someone please assist me with this? (Right now, my main goal is to simply insert the data into ...

How to implement a custom context menu for li elements using Right Click in HTML

I have a specific requirement to display a customized right-click menu on certain li items. I came across a js file at The issue I am facing is that the right-click functionality in this js file works for the entire page, but I need it to only work for se ...

Expand the <div> by clicking on it, then hover away to return it to its normal size

One interesting feature I have on my website is a <div> that expands when clicked, and returns to normal size with another click. However, I am looking for something a bit different... What I want is for the <div> (with the class name .topHead ...

What is the best way to expand the header, content, and footer colors to cover the entire width of a page while keeping everything centered within a fixed width

I managed to get the header and main content area to stretch across the full page, while keeping the content centered. But now I am facing an issue with the footer not stretching like the header. How can I make the footer stretch as well? HTML: <body ...

Having Trouble Adding a CSS File to Your Django Project? Can't Seem to Get it

I am feeling exhausted trying to solve this problem and now I am in desperate need of help. I have been attempting to add a main.css file to my Django project so that I can handle the CSS myself. I have watched numerous tutorials, but most have crashed m ...

Troublesome Zopim Widget Design Dilemma

After adding the Zopim widget code to the head section of my website, I found that it consistently loads with a black color theme, ignoring any color settings I try to apply. I've attempted to adjust the styles using CSS and Javascript, but so far not ...

Using ES6 Template Strings for Template Binding in Angular 4

There's something I was able to easily accomplish in Vue, but for some reason, it doesn't seem to work in Angular 4: <div class="time-translate" [ngStyle]="{transform: `translate3d(${gridTranslateX}px, 0, 0)`}"> It appears that I may have ...

Requesting user input prior to initiating Selenium, and then retaining the input for future reference in a Python script

I am currently working on a basic script to automate web browsing, but it's quite messy and I am a beginner in this field. Before running the entire script, I want to create a prompt that will ask the user for input. This input will be stored in diff ...

Traverse the list of JSON arrays

We've recently kicked off our 3rd semester just two weeks ago, diving into the world of basic event/DOM/fetch manipulation. My current task involves fetching data from https://jsonplaceholder.typicode.com/users, focusing on extracting all names and p ...

How can we prevent the modal from extending beyond the boundaries of the phone screen when zoomed in

I am currently developing a web application that features a large content page, specifically a map which should display detailed information upon zooming in similar to Google Maps. The interactive elements on my map are clickable, triggering a modal popup ...

Is it possible to dynamically adjust the size of the CircleProgressComponent element in ng-circle-progress?

For my current Angular 11 project, I am facing the challenge of dynamically changing the size of the ng-circle-progress library's CircleProgressComponent element. After some research, I discovered that the element's size can be adjusted by apply ...

How can I troubleshoot the overflow-y problem in a tab modal from w3 school?

https://www.example.com/code-sample overflow: scroll; overflow-y: scroll; When I type a lot of words, they become hidden so I need to use overflow-y=scroll. Despite trying both overflow: scroll; and overflow-y: scroll;, I have been unable to achieve the ...

What issues could arise from utilizing PHP for generating variables within my CSS file?

One major limitation of CSS is the absence of variables. It would be beneficial to have the ability to use variables for controlling things like the location of imported CSS and color schemes within a design. An alternative solution could involve using a ...

Angular ng-click feature for a dropdown option element

Check out this jsfiddle link: http://jsfiddle.net/cuycbxxp/ Within this dropdown selection, you can choose between names and numbers. Once you select a name and then select a number from the dropdown, a function is executed and an output is displayed in ...

How to style the 'FILE' input type in HTML

What is the best way to style a file upload button with an image to ensure it looks neat and tidy across all browsers without any overlapping text from the default control? Appreciate your help! ...

Creating a Bootstrap column that is the height of two rows

Trying to create a calculator and have achieved perfect alignment for most elements, but struggling to fit in one last button. I need this button to be the height of two rows, but adjusting its height directly causes issues with rows below. https://i.ssta ...

Retrieve the specific options chosen from a multi-selection dropdown menu and incorporate them into a JSON object

I need to input data for a book in the following format <div class="form-group"> <label for="Id">Book Id</label> <input type="text" class="form-control" id="Id" placeholder="Book Id" requi ...

What steps do I need to follow to create a 3D shooting game using HTML5 Canvas?

I'm eager to create a 3D shooter game with HTML5 Canvas, focusing solely on shooting mechanics without any movement. Can anyone provide guidance on how to accomplish this? I've looked for tutorials online, but haven't come across any that m ...