Arrange two tables side by side horizontally using CSS styling

I'm new to CSS and looking for help on how to format a table to appear as two distinct tables side by side. I want the brown cells to be brown and the rest blue.

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

Here is my attempt so far, but I'm struggling with setting the border widths correctly. Any assistance with CSS would be greatly appreciated:

html {overflow: auto;}

div.dhtmlx_window_active, div.dhx_modal_cover_dv { position: fixed !important; }
body{width:99%;}
table {
width: 100%;
border-collapse: collapse;
text-align: center;
white-space: nowrap;
}
table * {
  border: 1px solid black;
}
table thead * {
  background-color: rgb(242, 242, 242);
}
.titlePrev {
background-color: rgb(183, 222, 232);
}
.titlegeneriquedpt {
background-color: rgb(196, 189, 151);
}
table tbody * {
background-color: rgb(218, 238, 243);
}
.generiquedpt {
background-color: rgb(238, 236, 225);
}

th:first-child, td:first-child {
  border-left: 2px;
}
<table><thead>
<tr>
...

Don't worry about the colspan settings I've used, they are necessary for future tables on this page.

Answer №1

After brainstorming, I have devised a potential solution. Nevertheless, its effectiveness remains unknown. Let's delve into it:

html {overflow: auto;}

div.dhtmlx_window_active, div.dhx_modal_cover_dv { position: fixed !important; }
body{width:99%;}
table {
width: 100%;
border-collapse: collapse;
text-align: center;
white-space: nowrap;
}
table * {
  border: 1px solid black;
}
table thead * {
  background-color: rgb(242, 242, 242);
}
.titlePrev {
background-color: rgb(183, 222, 232);
}
.titlegeneriquedpt {
background-color: rgb(196, 189, 151);
}
table tbody * {
background-color: rgb(218, 238, 243);
}
.generiquedpt {
background-color: rgb(238, 236, 225);
}

th:first-child, td:first-child {
  border-left: 2px;
}

.bl{
  border-left-style: solid;
  border-left-width: medium;
}
.br{
  border-right-style: solid;
  border-right-width: medium;
}
.bt{
  border-top-style: solid;
  border-top-width: medium;
}
.bb{
  border-bottom-style: solid;
  border-bottom-width: medium;
}
<table><thead>
<tr class="bl br bt">
<th colspan=14 class="titlePrev br">A</th>
<th colspan=13 class="titlegeneriquedpt">B</th>
</tr><tr class="bl br">
<th colspan=3>TEXT</th>
<th rowspan=3>TEXT</th>
<th colspan=8 >TEXT</th>
<th colspan=2 rowspan=2 class="br">TEXT</th>
<td colspan=2 rowspan=2>TEXT</td>
<td colspan=2 rowspan=2>TEXT</td>
<td colspan=2 rowspan=2>TEXT</td>
<td colspan=2 rowspan=2>TEXT</td>
<td colspan=3 rowspan=2>TEXT</td>
<th colspan=2 rowspan=2 >TEXT</th>
</tr><tr class="bl br">
<td rowspan=2>TEXT</td>
<td rowspan=2>TEXT</td>
<td rowspan=2>TEXT</td>
<td colspan=3>TEXT</td>
<td colspan=4>TEXT</td>
<td rowspan=2>TEXT</td>
</tr><tr class="bl br">
<td>TEXT</td>
<td>TEXT</td>
<td>TEXT</td>
<td>TEXT</td>
<td>TEXT</td>
<td>TEXT</td>
<td>TEXT</td>
<td>TEXT</td>
<td class="br">TEXT</td>
<td colspan=2>TEXT</td>
<td>TEXT</td>
<td>TEXT</td>
<td>TEXT</td>
<td>TEXT</td>
<td>TEXT</td>
<td>TEXT</td>
<td>TEXT</td>
<td>TEXT</td>
<td>TEXT</td>
<td>TEXT</td>
<th>TEXT</th>
<th>TEXT</th>
</tr></thead>
<tbody><tr class="bl br">
<td>TEXT</td>
<td>TEXT</td>
<td>TEXT</td>
<td>TEXT</td>
<td>TEXT</td>
<td>TEXT</td>
<td>TEXT</td>
<td>TEXT</td>
<td>TEXT</td>
<td>TEXT</td>
<td>TEXT</td>
<td>TEXT</td>
<td>TEXT</td>
<td class="br">TEXT</td>
<td class="generiquedpt" colspan=2>TEXT</td>
<td class="generiquedpt">TEXT</td>
<td class="generiquedpt">TEXT</td>
<td class="generiquedpt">TEXT</td>
<td class="generiquedpt">TEXT</td>
<td class="generiquedpt">TEXT</td>
<td class="generiquedpt">TEXT</td>
<td class="generiquedpt">TEXT</td>
<td class="generiquedpt">TEXT</td>
<td class="generiquedpt">TEXT</td>
<td class="generiquedpt">TEXT</td>
<td class="generiquedpt">TEXT</td>
</tr><tr class="bl br">
<td>TEXT</td>
<td>TEXT</td>
<td>TEXT</td>
<td>TEXT</td>
<td>TEXT</td>
<td>TEXT</td>
<td>TEXT</td>
<td>TEXT</td>
<td>TEXT</td>
<td>TEXT</td>
<td>TEXT</td>
<td>TEXT</td>
<td>TEXT</td>
<td class="br">TEXT</td>
<td class="generiquedpt" colspan=2>TEXT</td>
<td class="generiquedpt">TEXT</td>
<td class="generiquedpt">TEXT</td>
<td class="generiquedpt">TEXT</td>
<td class="generiquedpt">TEXT</td>
<td class="generiquedpt">TEXT</td>
<td class="generiquedpt">TEXT</td>
<td class="generiquedpt">TEXT</td>
<td class="generiquedpt">TEXT</td>
<td class="generiquedpt">TEXT</td>
<td class="generiquedpt">TEXT</td>
<td class="generiquedpt ">TEXT</td>
</tr><tr class="bl br">
</tr></tbody>
<tfoot><tr class="bl br bb">
<th class="titlePrev" colspan=3>TEXT</th>
<td class="titlePrev">TEXT</td>
<td class="titlePrev">TEXT</td>
<td class="titlePrev">TEXT</td>
<td class="titlePrev">TEXT</td>
<td class="titlePrev">TEXT</td>
<td class="titlePrev">TEXT</td>
<td class="titlePrev">TEXT</td>
<td class="titlePrev">TEXT</td>
<td class="titlePrev">TEXT</td>
<td class="titlePrev">TEXT</td>
<td class="titlePrev br">TEXT</td>
<td class="titlegeneriquedpt" colspan=2>TEXT</td>
<td class="titlegeneriquedpt">TEXT</td>
<td class="titlegeneriquedpt">TEXT</td>
<td class="titlegeneriquedpt">TEXT</td>
<td class="titlegeneriquedpt">TEXT</td>
<td class="titlegeneriquedpt">TEXT</td>
<td class="titlegeneriquedpt">TEXT</td>
<td class="titlegeneriquedpt">TEXT</td>
<td class="titlegeneriquedpt">TEXT</td>
<td class="titlegeneriquedpt">TEXT</td>
<td class="titlegeneriquedpt">TEXT</td>
<td class="titlegeneriquedpt">TEXT</td> 
</tr></tfoot>
</table>

The addition of the 4 classes will determine where the borders are applied. Hopefully, this guidance proves beneficial.

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

Having trouble implementing absolute css positioning on my custom composite button

I encountered a peculiar issue that I have managed to work around, but I am still curious about why it is happening. Below is the code for my Composite class: import com.google.gwt.event.dom.client.ClickEvent; import com.google.gwt.event.dom.clie ...

Is there a way to achieve a straightforward three-column stacked layout in Bootstrap 5 that spans 100% of the viewport height?

Today I decided to try out Bootstrap 5 for the first time. However, I am facing a challenge in creating a 3 stacked column layout with box-1, box-2, and box-3 on top of each other, taking up 100vh. I have shared a redacted version of the code below, wher ...

Adjust the text placement following its entry on the screen

I'm currently facing an issue with my code that involves text sliding in and then moving to the left after the slide completes. How can I ensure that the text remains in place once the slide is finished? <style> div.slide-left { width: ...

Using jQuery does not automatically pre-check multiple checkboxes. This issue may arise when using PHP and AJAX together

I'm attempting to dynamically check multiple checkboxes based on previous entries from a MySQL database. I have the data stored in a variable: var = ObjektLevHur; The potential data values are: frittlev, frittfabrik, or mont. When I make my first sele ...

Issue with toggleClass being triggered twice while resizing browser window

I am currently in the process of creating a responsive navigation menu. I have completed the initial setup but encountered an issue while resizing the browser window. It appears that the toggleClass function is being triggered multiple times when I resize ...

Are you considering using requestAnimationFrame on your iPhone?

Can the requestAnimationFrame function be used on an iPhone running iOS 5.1? Based on my research, it seems that mobile Safari does not support this method, regardless of whether or not a vendor prefix is used. ...

In Internet Explorer, the toggle div expands to fill the available space, but this behavior is not consistent in

Utilizing the toggle function in jQuery, I created a mechanism to switch between 4 different blocks of content. You can view a demonstration of how the functionality operates correctly in Google Chrome here: If you encounter any issues with the functiona ...

What is the best way to incorporate a sliding effect into my cookie form?

I created a cookie consent form for my website and I'm looking to include a sliding effect when it first appears and when it disappears after the button is clicked. How can I implement this sliding effect into the form? Here's the HTML, CSS, and ...

Apple's iPhone does not adhere to media query specifications

My responsive website was functioning perfectly on desktop, Android, and Windows Phone devices. However, when I asked my friends to check it on their iPhones running iOS 10, they informed me that the media queries were being ignored on iPhone models 5, 5s, ...

Resizing an image for mobile using next/Image

I have been using next/Image in conjunction with tailwind to display an image as a banner that spans the entire width of its container, which happens to be the full page width. The challenge I am facing is that the image appears distorted and unbalanced o ...

The canvas that has been downloaded is showing a font that is not the

I'm facing an issue with my code. After downloading an image that includes a canvas and a div on top of it, I noticed that the font style of the div is different from what I had specified. Below is the code for the Div: <div id="memePlaceHolder" ...

How can you make the contents of a <DIV> expand?

Picture a scenario where I have a navigation bar in the header of my web page, consisting of several links. What I want is for these links to expand horizontally to fill the parent container without me having to hard-code based on the number of links. In o ...

Display unique menus for both users and administrators

I have been researching extensively to find a solution to my problem, but I am struggling to make things work properly. Here is the code I currently have: Login script: $submitted_username = ''; if(!empty($_POST)) { ...

Generating a dynamic table using Angular

My goal is to populate a table dynamically using the code below: teams.component.ts import { Component, OnInit } from '@angular/core'; import { first } from 'rxjs/operators'; import { TeamService } from 'src/app/services/team.ser ...

Styling the Material UI ImageList with a fade scroll effect

I am currently working on a horizontal scrolling ImageList using Material UI V5, and I'm looking to create a smoother transition at the edges of the list. I have managed to fade the edges, but my goal is to only fade them when the user has reached the ...

Using jQuery to control mouseenter and mouseleave events to block child elements and magnify images

My objective is to create a hover effect for images within specific div elements. The images should enlarge when the user hovers their mouse over the respective div element. I plan to achieve this by adding a child element inside each div element. When the ...

Personalized HTML ProgressBar featuring indicators

As I explore options for creating a progress bar/timeline with the ability to add markings (white lines shown in the image below) upon clicking a button, I've looked into HTML5 canvas and custom jQuery solutions. I'm curious if anyone has any spe ...

Tips on creating an editable table row in Angular to easily update values

I'm currently developing an Angular application which is meant to extract data from an excel sheet and exhibit it in a table upon upload. I have incorporated an edit link beneath one column for the purpose of editing the row data; once you click on ed ...

Determining if an HTML dialog was closed using the escape key

Wondering about detecting when an HTML dialog is closed using the ESC key. Specifically referring to the HTML dialog, not jQuery. ...

What is the best way to incorporate animation using Tailwind CSS within my Next.js project?

I have a challenge with placing three images in a circular path one after the other using Tailwind CSS for styling. I've identified the circular path and keyframe style for the images. How do I configure this style in my Tailwind config file and imple ...