unable to decrease the gap between the rows of the table

I'm currently developing an application that involves a table with rows and columns, along with a checkbox container arranged as shown in the image below:

https://i.stack.imgur.com/QoVrg.png

One issue I'm facing is getting the letters A, B, C, D (which correspond to each row) to align at the same height as my checkboxes. Despite adjusting margins and padding between the letters, I haven't seen any visible changes. Any assistance would be greatly appreciated.

Here's a snippet of my code:

.checkboxes-container{
  position: absolute;
  width:620px;
  height:240px;
  left:25%;
  top:42%;
  display:flex;
  justify-content: flex-start; 
}

.checkbox-container{
  background-color:teal;
  width:230px;
  height:100%;
  display:flex;
  flex-flow:row wrap;
  justify-content:flex-start;
}


.checkbox-container div{
  flex-basis:100%;
}



.business-bx{
  margin-top:17px;
  transform:scale(1.5);  
}

.business-bx:not(:first-child){
  margin-left:38px;
}

.business-bx:first-child{
  margin-left:10px;
}


.table tbody tr td:first-child {
  font-weight:bold;
}

.table {
  border-spacing: 3em;
}


.letter{
  font-size:20px;
  padding:0;
}
<div class="table-container">
  <table class="table">
    <thead>
      <tr>
        <td></td>
        <td>1</td>
        <td>2</td>
        <td>3</td>
        <td>4</td>


      </tr>
    </thead>
    <tbody>
      <tr class="letter">
        <td>A</td>

      </tr>
      <tr class="letter">
        <td>B</td>

      </tr>
      <tr class="letter">
        <td>C</td>

      </tr>
      <tr class="letter">
        <td>D</td>

      </tr>
    </tbody>
  </table>
</div>

<div class="checkboxes-container">
  <div class="checkbox-container business-boxes">
    <div>
      <input type="checkbox" class="business-bx">
      <input type="checkbox" class="business-bx">
      <input type="checkbox" class="business-bx">
      <input type="checkbox" class="business-bx">
    </div>
    <div>
      <input type="checkbox" class="business-bx">
      <input type="checkbox" class="business-bx">
      <input type="checkbox" class="business-bx">
      <input type="checkbox" class="business-bx">
    </div>
    <div>
      <input type="checkbox" class="business-bx">
      <input type="checkbox" class="business-bx">
      <input type="checkbox" class="business-bx">
      <input type="checkbox" class="business-bx">
    </div>
    <div>
      <input type="checkbox" class="business-bx">
      <input type="checkbox" class="business-bx">
      <input type="checkbox" class="business-bx">
      <input type="checkbox" class="business-bx">
    </div>

  </div>


</div>

Answer №1

To enhance the functionality of your checkbox code, you can integrate it with a table structure. Below is the modified code:

tbody>tr>td:not(:first-child) {
    background-color: teal;
    padding:20px;
}
tbody>tr>td{
    padding-right:5px;
}
thead>tr>td{
    text-align: center;
}
table{border-collapse: collapse;}
<div class="table-container">
    <table class="table">
        <thead>
            <tr>
                <td></td>
                <td>1</td>
                <td>2</td>
                <td>3</td>
                <td>4</td>
            </tr>
        </thead>
        <tbody>
            <tr class="letter">
                <td>A</td>
                <td><input type="checkbox" class="business-bx"></td>
                <td><input type="checkbox" class="business-bx"></td>
                <td><input type="checkbox" class="business-bx"></td>
                <td><input type="checkbox" class="business-bx"></td>
            </tr>
            <tr class="letter">
                <td>B</td>
                <td><input type="checkbox" class="business-bx"></td>
                <td><input type="checkbox" class="business-bx"></td>
                <td><input type="checkbox" class="business-bx"></td>
                <td><input type="checkbox" class="business-bx"></td>
            </tr>
            <tr class="letter">
                <td>C</td>
                <td><input type="checkbox" class="business-bx"></td>
                <td><input type="checkbox" class="business-bx"></td>
                <td><input type="checkbox" class="business-bx"></td>
                <td><input type="checkbox" class="business-bx"></td>
            </tr>
            <tr class="letter">
                <td>D</td>
                <td><input type="checkbox" class="business-bx"></td>
                <td><input type="checkbox" class="business-bx"></td>
                <td><input type="checkbox" class="business-bx"></td>
                <td><input type="checkbox" class="business-bx"></td>
            </tr>
        </tbody>
    </table>
</div>

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

Updating the jQuery mobile webpage

I have set up a small demo with two pages - the Home page and the Team 1 page. By clicking on the navigation menu, you can navigate to the Team 1 page from the Home page. However, if you are already on the Team 1 page and click on the Team 1 button again ...

The layout of the table is not formatted in a single continuous line

I recently implemented the material-ui table and noticed that the header has a multiline break space. I am looking for a way to make it display in a single line instead. Is there any solution for achieving this using material UI or CSS? Feel free to chec ...

Position a div off-center using CSS styling

Currently, I am utilizing a flexbox to center a div inside another div, akin to a dialog window that pops up at the center of the screen when required. The functionality is sound, but aesthetically it would be more pleasing if the space above and below th ...

Aligning an SVG icon at the center of a button

I have elements that are currently being used as buttons, but I want to switch them out for actual button tags. This would improve accessibility and allow keyboard navigation using the tab key to focus on my buttons. Each button contains a centered SVG ima ...

What is the method for adding an event listener in AngularJS within an ng-repeat iteration?

I'm completely new to AngularJS and currently working on building a photo gallery. The basic idea is to have an initial page displaying thumbnail photos from Twitter and Instagram using an AngularJS ng-repeat loop. When a user hovers over an image, I ...

At times, PHP mail usage may result in certain $_POST arrays being unexpectedly empty

I've encountered an issue while using the php mail function to send data from a html form. The mail function is functioning correctly and I receive the email upon form submission, but occasionally I receive empty arrays in the email content. Here is ...

Gallery of Disappearing Images

I am encountering issues with the image gallery on my website, as it seems to create a space to the right when viewed on screens smaller than 350px. This results in a gap on the entire right side of the page. My goal is to make this image gallery responsiv ...

Ensuring responsive design: Forcing Bootstrap 3 / Knockout Navbar to collapse on mobile site view

While working on a website, I incorporated Knockout.js and added a click event to a href in the navbar. The issue is that the navbar doesn't automatically close when using it on a mobile device after the click event triggers. Is there a way to ensure ...

Adjusting the angular routerLink based on an observable

When working with HTML in Angular, I am looking for a way to use an <a> tag that adjusts its routerlink based on whether or not a user is logged in. Is it possible to achieve this functionality within a single tag? <a *ngIf="!(accountService ...

CSS: the max-width property does not constrain an absolute positioned container from overflowing

I've been trying to figure this out for hours, but I can't seem to get it right. My top menu has submenus that include a popup menu. In one of my popups, I need the container to have a maximum width of 170 pixels and all the items inside to wra ...

Send the user to a specified destination

Currently, I am working on creating a form that allows users to input a location and have the page redirect to that location after submission. However, I am facing difficulty in determining how to set the value for action="" when I do not know what the loc ...

Brick-themed HTML/CSS elements drift away from each other

I'm currently designing an image collage for my website and attempted to use masonry for the layout. However, when I adjust the size of the blocks, they seem to drift apart, creating large gaps between each block. Any suggestions on how to resolve thi ...

Center align the mat-expansion-panel material component in a vertical orientation

When working with the mat-expansion-panel component alongside a mat-accordion, I've encountered an issue where the items are not aligning vertically at the center/middle. I'm unsure of the proper method to achieve vertical alignment for the conte ...

How to target and style multiple descendants of an element using CSS

Can you target multiple elements with a common ancestor in CSS using class, id, etc? For example: table.exams caption, tbody, tfoot, thead, tr, th, td If not, is there a method to select all nested elements within that particular element? ...

Gaining a comprehensive understanding of media queries

Hello everyone, I need some help with media queries. I've been working on a website that is already responsive. However, I am required to write the code in a child theme rather than directly in the original files. When I attempt to add new media quer ...

Github not recognizing CSS styles

Currently working on a website to showcase the games I've developed, but encountering issues with applying my CSS. The code can be found here. As a novice in HTML and CSS coding, I've tried numerous codes and tutorials without success. ...

What's preventing the buttons from shifting positions?

Having some trouble with my Minesweeper Web Game setup. My buttons are stuck in place and won't budge. Can someone help me figure out what's wrong? Here's the code snippet I've been working on (FYI, using NetBeans 8.1 IDE) HTML: <! ...

The app was rejected from the Play Store due to a breach of section 4.4 in the Developer Distribution Agreement

Just got an email notification that my application submission, Chami Browser, has been rejected due to violation of section 4.4 of the Developer Distribution Agreement. The reason for rejection is accessing YouTube videos in violation of their Terms of Se ...

Ways to hide the value from being shown

I have integrated jscolor (from jscolor) to allow users to pick a color with an input field. However, I am facing issues in styling it as I'm unable to remove the hex value of the selected color and couldn't find any relevant documentation on av ...

Is it possible to successfully pass a parameter from a servlet to a JavaScript function, but encounter issues when trying to view the database

In my view servlet, I am displaying user data from the database in a table. Each row of the table has buttons that allow users to change the cells in that row to text boxes. The issue I am encountering is that when I retrieve the data and loop through to ...