Set up two separate tables with sufficient space in between each other

Is there a way to align these two tables next to each other with some space between them? Currently, they appear one below the other. How can I make them sit beside each other with spacing in between? If anyone knows how to do this, please help me out.

<style type="text/css">
    .tftable {
        font-size:       12px;
        color:           #333333;
        width:           100%;
        border-width:    1px;
        border-color:    #729ea5;
        border-collapse: collapse;
    }

    .tftable th {
        font-size:        12px;
        background-color: #acc8cc;
        border-width:     1px;
        padding:          8px;
        border-style:     solid;
        border-color:     #729ea5;
        text-align:       left;
    }

    .tftable tr {
        background-color: #d4e3e5;
    }

    .tftable td {
        font-size:    12px;
        border-width: 1px;
        padding:      8px;
        border-style: solid;
        border-color: #729ea5;
    }

    .tftable tr:hover {
        background-color: #ffffff;
    }
</style>

<table class="tftable" border="1">
    <tr><th>Header 1</th></tr>
    <tr><td>Row:1 Cell:1</td></tr>
    <tr><td>Row:2 Cell:1</td></tr>
    <tr><td>Row:3 Cell:1</td></tr>
    <tr><td>Row:4 Cell:1</td></tr>
    <tr><td>Row:5 Cell:1</td></tr>
    <tr><td>Row:6 Cell:1</td></tr>
    </table>

Is it possible to include a line break within the header as well? This code snippet did not seem to work:

<tr><th><br />Header 1</th></tr>

Any suggestions or solutions would be greatly appreciated.

Answer №1

Upon reviewing your code, it appears that the issue lies in how you structured the tables. To correct this error, please refer to the updated code below:

<table class="tftable" border="1">
<tr><th>Header 1</th></tr>
<tr><td>Row:1 Cell:1</td></tr>
<tr><td>Row:2 Cell:1</td></tr>
<tr><td>Row:3 Cell:1</td></tr>
<tr><td>Row:4 Cell:1</td></tr>
<tr><td>Row:5 Cell:1</td></tr>
<tr><td>Row:6 Cell:1</td></tr>
</table>

<table class="tftable" border="1">
<tr><th>Header 1</th></tr>
<tr><td>Row:1 Cell:1</td></tr>
<tr><td>Row:2 Cell:1</td></tr>
<tr><td>Row:3 Cell:1</td></tr>
<tr><td>Row:4 Cell:1</td></tr>
<tr><td>Row:5 Cell:1</td></tr>
<tr><td>Row:6 Cell:1</td></tr>

Please refer to this DEMO for a visual representation of the corrected code:

https://jsfiddle.net/wgrLfxg3/6/

Answer №2

What do you think of this?

.tblgrid {
 float: right;
 margin-left: 5%;
 width:50%;
}

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

Adding click functionality to dynamically generated list items in jQuery and HTML

I'm encountering an issue while trying to assign click events to dynamically added HTML elements in jQuery. Despite extensive research within this community, I find myself more confused than before. Below is the snippet of code causing me trouble: v ...

Dynamic content cannot have classes added to them using jQuery

When adding content dynamically, it is necessary to use an event handler for a parent element using on(). However, I am facing an issue where the class added with addClass on dynamically generated content disappears immediately. Let's take a look at ...

The background on my modal remains unchanged

I have integrated a modal using Iframe for user login/registration on my website. Here is the HTML code: <div class="modal" id="ays-popin-connexion" aria-hidden="true"> <div class="modal-body" aria-hidden="true"> <iframe src=" ...

Breaking up and Substituting text within Angular 8's HTML structure

When I retrieve data from a REST api, I need to split the name parameter at '2330' and insert a line break. For example, if the name is: ABCD 2330 This is My Name, I want the output on my screen to appear as: ABCD 2330 This is My Name // this par ...

Tips for organizing three flexbox divs in a horizontal row

Within the content div, I have three separate divs that resize when the browser window is adjusted. The blue and red divs should maintain a fixed width The green div should resize to fill any available space on the left I attempted to accomplish this usi ...

Creating a continuous loop in JQuery when clicking on a table row

I seem to be encountering an issue with what appears to be an infinite loop. My problem arises while trying to create a table dynamically using Ajax. Each row of the table contains a button alongside a thumbnail image and some text. I wish for the button ...

`No valid form submission when radio buttons used in AngularJS`

Within my form, I have a single input text field that is required (ng-required="true") and a group of radio buttons (each with ng-model="House.window" and ng-required="!House.window"). Interestingly, I've discovered that if I select a radio button fir ...

Reducing the Bootstrap Navbar Collapse Width

After spending all day searching for an answer, I still haven't found a solution to my problem. Here is the code I am struggling with: <div class="visible-xs navbar navbar-ti navbar-fixed-top "> <div class="container"> <div class ...

The Power of the CSS Universal Selector and Specificity

Currently exploring the puzzling scenario where .x seems to have higher specificity than *.x, despite expectations. Shouldn't *.x technically have a specificity of 0-0-1-1 (1 class, 1 tag) while .x is just one class with specificity 0-0-1-0? Let&apo ...

Issue where the background color remains the same and does not change

I'm having trouble identifying the issue in this code. I am attempting to change the background color using the following CSS: body { background-color: black; padding: 0px; margin:0px; height: 1500px; } However, it doesn't seem to ...

Partial button clickability issue

There is a puzzling error where the button in the 'red area' is not clickable, and I can't seem to figure out why. Below are images illustrating the issue: https://i.stack.imgur.com/aPfcR.png https://i.stack.imgur.com/v5knZ.png Upon reac ...

How to use jQuery to target the second or any desired div element with a specific class

I'm having trouble with something seemingly simple Let's say we are looking for a class called .contentdiv, for example. I am trying to target the second or nth occurrence of the .contentdiv class in a document and retrieve the HTML of that spe ...

What is the process for integrating SAP BO objects into HTML containers?

Has anyone successfully integrated a SAP BO object into an HTML container? I'm looking to embed a dashboard directly onto my webpage instead of redirecting users to a new tab for the Business Objects platform. ...

Is it possible to increase the delay in the nth-child selector?

I'm attempting to create a compact checklist that displays in a single row with items appearing sequentially. To achieve this, I utilized the :nth-child() selector in CSS as shown below: .animated { -webkit-animation-duration: 0.8s; animation-d ...

Is the background image on my class website too large?

I am having an issue with the redbar.png image in my CSS. It is positioned too high (within #container) and overlapping with the horizontal nav bar when it shouldn't be. I'm uncertain how to fix this problem. Any suggestions would be greatly appr ...

Are there any small JavaScript libraries designed for handling HTML5 history?

I experimented with AngularJS and found it to be a powerful but heavy framework, with a size of over 100k. Is there a more lightweight JavaScript framework specifically for managing HTML5 webpage history in an MVC project? What are your thoughts on using ...

Disabling the @import cache feature in LessCSS Assetic

I'm facing a minor issue that is robbing me of precious time. Currently, I am using the assetic plugin with the lesscss filter in my symfony2.1 project. The problem lies in Assetic not detecting changes in imported files when using the @import functi ...

Having trouble establishing a connection between the client and server while using Node.js with socket.io, Express, and an HTML file

While following a tutorial on YouTube for creating a simple web game with lobbies/rooms, I encountered an issue. When attempting to establish a connection between the client and server, the expected "a user connected" text did not show up in the console as ...

Enhance the appearance of the input range by styling it with an additional class both before and

I have a JSF page where I am using an input range element. I want to add a different style class before and after the input range. Specifically, I want to display a plus icon (ui-icon-plusthick) before the input and a minus icon (ui-icon-minus) after the i ...

The problem of Twitter Bootstrap 2 top navigation dropdown not functioning properly on mobile devices

I’ve spent a significant amount of time researching the issue prior to reaching out here, but unfortunately I haven’t been able to find a solution yet. Website Link: Currently, I am using Twitter Bootstrap 2.3.2 and have integrated a form in the drop ...