What is the best way to create space between table rows without using border-spacing?

I've been attempting to use the margin-bottom property on my table in order to separate the rows, but it doesn't seem to have any effect. I then tried using flex, which did work, but the table rows did not inherit the width and I had to specify a specific width. Is there another method to achieve the separation of table rows?

Here is the code snippet using flex:

<table className="w-full text-sm text-left lg:table-fixed table-fixed">
<thead className="text-sm text-white text-opacity-50 font-normal ">
...
</thead>
{() => (
<tbody className={classNames({ ' text-white text-sm   flex flex-col': true })}>
{dataT.map(vt => {
return <VaultTransactionsRow key={vt.id} {...vt} />
})}
</tbody>
)}
</table>

Here is the table I created using flex

Here is the table I created where the margin-bottom has no effect

Answer №1

For some extra room between table elements, apply border-collapse:seprate in conjunction with border-spacing.

table {
    border-collapse: separate;
    border-spacing: 0 1em;
}

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

What is the best way to transform a JavaScript object into an array?

Here is the information I have: {product_quantity: {quantity: 13, code: "AAA", warehouse: "1000",}} The product_quantity field is part of a JSON object in a MongoDB database. I am looking to convert it into this format: {"produ ...

Simple steps to correct the npm installation of the React list filter

I encountered an issue while trying to install react-list-filter using npm (npm install react-list-filter). The error messages displayed in my console are as follows: npm ERR! code ETARGET npm ERR! notarget No matching version found for <a href="/cdn-c ...

Stop node.js from automatically converting a nested object containing numeric keys into an array

Every time I send an object with a nested object containing keys that are numbers to my node.js server, the nested object gets converted into an array. Is there a way to prevent this from happening? Client: $.ajax({ url : `/cctool/report`, method ...

Challenges with adjusting the dimensions of varying-sized fluid squares that are floated

I've been facing a roadblock in my coding project since yesterday afternoon. I'm trying to transform a classic unordered list menu into a tiled "gallery" within a 12 column grid, with fluid square tiles. When the squares are floated, the first s ...

Using Masonry with AngularJS templates: A step-by-step guide

Hey there! I'm trying to incorporate masonry into my AngularJS project. I'd like the divs to flow from left to right within their container. The documentation suggests using the following code: <div class="js-masonry" data-masonry-options=&ap ...

Leverage object properties as data table field values in VueJS

In my current project, I am utilizing VueJS (version 2.5.9) to display and modify data tables within an administrative application. Initially, I used a basic Grid component for the data table, following an example provided here. However, I came across an e ...

Utilize distinct JavaScript library files for various components

I'm currently working on a website developed in ReactJS. Within the public/index.html file, I have the following code snippets: <head> <script src="/lib/analyzejs-v1.js"></script> <script src="/lib/analyzejs-v2. ...

Handling type errors with React Typescript MuiAccordion OnChange event handler

I'm a beginner in typescript and seeking advice on defining the type for an event handler. I have a component that utilizes material ui Accordion and triggers the handler from a container. Therefore, I need to specify the type of handleChange in my co ...

When utilizing a third-party library in conjunction with Vuetify, the V-menu may have a tendency to automatically close right after

Incorporating cytoscape into a vuetify SPA has been successful for the most part. The graph renders within a v-card-element, and I can navigate to a different page using the vue router when clicking a note in the graph. However, when attempting to replace ...

Numerous data retrieval commands within the componentWillMount lifecycle method

Initially, I utilized the componentWillMount() method to populate the articles property successfully by iterating over the values to display various images/text. However, I am now encountering an issue as I also need to use componentWillMount to populate ...

Can't get className to work in VueJS function

I need help changing the classNames of elements with the "link" class. When I call a method via a click action, I can successfully get the length of the elements, but adding a class does not seem to work. Does anyone have any insights into this issue? HTM ...

JavaScript's Use of Brackets

I’ve been working on a new project that involves adding links. To do this, users can input both the link URL and the text they want displayed. I used a prompt to gather this information. Here’s the code snippet I wrote: document.getElementById(ev.targ ...

Unable to get i18next functioning in my Node.js Express backend

I'm currently facing difficulties in implementing localization for my nodeJS backend. Within my Angular frontend, I have a language-setting interceptor that successfully sets the language in the request header. You can refer to the image below which ...

What are the best practices for correctly implementing Angularjs ng-repeat?

As a newcomer to angularjs, I am in the process of building an app where the output is already set up correctly. However, I am looking to achieve the same without relying on jQuery, and instead want to utilize the angularjs method using "ng-repeat". Below ...

In instances where the text exceeds the width of the container, a horizontal scrollbar will appear

When looking at the custom content section on my website, you will find paragraphs and lists. One of the list items contains the following text: Track your package online: The link provided is quite lengthy and lacks white spaces, causing it to extend ...

Display only the relevant search results using ng-show in AngularJS

By utilizing the code below, I am able to filter results where all entries are displayed on the page: <body ng-app=""> <div ng-init="friends = [{name:'John', phone:'555-1276'}, {name: ...

Using JSON files with React.js for data manipulation

Can someone explain the process of parsing this json file and then rendering it? [ { "userId": 1, "id": 1, "title": "sunt aut facere repellat provident occaecati excepturi optio reprehenderit", "body": "quia et suscipit\nsuscipit re ...

javascript retrieving JSON data through an API request from a redirected URL

I am retrieving JSON data from the Glitch API. Upon opening the link, it redirects to a different domain (the domain was changed from gomix.me to glitch.me) When using Postman for both HTTP requests, I receive identical JSON data. However, there is a d ...

Behavior of routing not functioning as anticipated

In my app-routing.module.ts file, I have defined the following routes variable: const routes: Routes = [ { path: '', redirectTo: '/users', pathMatch: 'full' }, { path: 'users', component: UsersComponent }, ...

Is there a way to retrieve the count of each item within an array by utilizing the .map method in the React library

Currently, I am attempting to retrieve the quantity of each object in an array and then incorporate it into my JSX code to indicate which one it is. The data is being extracted from a file named tableData.js export const data = [ {price: 1500, isSold: f ...