The child and parent tables share identical borders

I am faced with a challenge involving two tables, one main and one child, both with 3 columns each. The child table is located within a row of the main table. My objective is to display these two tables as one cohesive unit with consistent borders. However, I have noticed that in certain browsers (such as Chrome), the border of the child table appears misplaced. How can I rectify this issue?

http://jsfiddle.net/yCSnf/

.html

<table class="main_table" cellpadding=0 cellspacing=0>
    <tr>
        <td>col1</td>
        <td>col2</td>
        <td>col3</td>
    </tr>
    <tr>
        <td>value1</td>
        <td>value2</td>
        <td>value3</td>
    </tr>
    <tr>
        <td colspan=3 class="child_table_wrap">
            <table cellpadding=0 cellspacing=0 class="child_table">
                <tr>
                    <td>child_col1</td>
                    <td>child_col2</td>
                    <td>child_col3</td>
                </tr>
                <tr>
                    <td>child_val1</td>
                    <td>child_val1</td>
                    <td>child_val1</td>
                </tr>
            </table>
        </td>
    </tr>
</table>

.css

table {border-collapse: collapse;}
table.main_table {border: 1px solid black; border-width: 1px 0 0 1px;}
td {width: 33%; border: 1px solid black; border-width: 0 1px 1px 0;}
td.child_table_wrap {border-width: 0;}

Answer №1

Modify this segment of css:

td {width: 33%; border: 1px solid black; border-width: 0 1px 1px 0;}

to the following:

td {width: 33.334%; border: 1px solid black; border-width: 0 1px 1px 0;}

Feedback Update

If that's the case, introduce a fixed width container:

.container {
    200px; //Adjust as needed.
}

HTML

<div class="container">
    <table class="main_table" cellpadding=0 cellspacing=0>
    //...
    </table>
</div>

http://jsfiddle.net/vsDwC/1/

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

Data within object not recognized by TableCell Material UI element

I am currently facing an issue where the content of an object is not being displayed within the Material UI component TableCell. Interestingly, I have used the same approach with the Title component and it shows the content without any problems. function ...

Having trouble with displaying the results of JQuery Ajax in Chrome?

I am facing a compatibility issue between IE 8 and Chrome 16.0.912.77 with the following code. Any suggestions? <html> <head> <script src="http://code.jquery.com/jquery-latest.js"></script> <script> $(document).ready(fu ...

Issues with jQueryUI sortable causing flickering and erratic movement while attempting to reorder and position items within the list

When using jQueryUI sortable with a long list of items, I encounter an issue where the items flicker and jump around the screen as I try to change their order by dragging them. This makes it nearly impossible to organize the items effectively. It seems li ...

What is the best way to add a box shadow to just one side of an element?

Is there a way to apply an inset box-shadow to only one side of a div? I am specifically referring to an inset shadow, not the usual outer box-shadow. For instance, in the JSFiddle below, you can observe that the inset shadow is visible on all four sides, ...

StringBuilder has the ability to handle HTML symbols

My view is supposed to display a drop-down list based on the data sent from the model. @{ StringBuilder sb = new StringBuilder("<select id=\"field"+Model.Id+"\">"); sb.Append("<option>Choose...</option>"); foreach(var s in Mod ...

How can you ensure that divs stay the same size and appear next to each other without resorting to using

I need assistance with organizing my website layout as shown below: https://i.sstatic.net/Dpof9.png The image div will display an image of variable size, which needs to be vertically and horizontally centered. The text div will contain a large amount of ...

delete the initial background color assigned to the button

The "ADD TO CART" and "save design" buttons are currently displaying as shown in the image below. I would like to make the "SAVE DESIGN" button look similar to the "ADD TO CART" button, meaning I want to remove the background-color and dot symbol. Code ...

Share the hyperlink to a webpage with someone else

In my SQL command, I have a unique feature that retrieves the complete URL value of the current page: [##cms.request.rawurl##]. This code returns the entire URL. I need to send this address to another page and load it into a special div called "load-fac". ...

Show an image on a webpage using a URL from a Firebase database with HTML

How can I dynamically display images from URLs in my table? My table automatically increments every time new data is added, but I'm having trouble displaying images. The table already shows the URL where the image should be displayed. Here is the ou ...

Stacked on top of one another are in-line block items

I've been working on this code for a while now, but I can't seem to get it right. My goal is to create a horizontal line of navigation links with the first link aligned to the left and the rest following in sequence like a text line. However, a ...

The magic of CSS Pseudo-classes in Inline Styling

For the longest time, I've been under the impression that you cannot include in-line :hover{..} styles to an element. However, recently I stumbled upon this page which showcased examples like this. <a href="http://www.w3.org/" s ...

ErrorPlacement in jQuery validation is causing an issue where errors cannot be removed even after they have been corrected

Can you assist me in resolving an issue? I am struggling with removing an error message once a user has corrected their mistake, particularly when it comes to validating an email field. The error keeps getting added multiple times until validation is succe ...

Adding a special ie7 glow effect to hyperlinks

Currently, I am facing an issue with a website that I am in the process of redesigning. The problem seems to be specific to Internet Explorer 7 (ie7). If you visit dev.indigoniche.com (you may be redirected back to the main site due to a cookie issue, in w ...

Building a dynamic table in AngularJS that pulls information from a REST API

I'm looking to utilize AngularJS to present a table. The data for this table will be sourced from a REST API. Here's an example of the response I expect: { "value": 43, "C_class": [ 1, 2, 3, 4, 5, 6, 7, 8, ...

Resizing input fields with Bootstrap 4

Is there a way to make form elements stretch to the whole row width in Bootstrap 4? The current arrangement looks quite messy: http://prntscr.com/id6pfm Here is the HTML: <div class="jumbotron vertical-center"> <div class="container-flu ...

Detect prohibited terms with Jquery

Check out this jsfiddle. I need assistance with a feature where certain specific words trigger an alert for the user when typed. Currently, if I type a phrase like I love ants, the entire line gets alerted. However, I want only the word ants to trigger th ...

stopping the current menu selection from altering its color

How can I stop the color change when hovering over the selected menu item? Here's my code: <html> <head> <title> Another Page </title> <link rel="stylesheet" href="style4.css" type="text/css" /> & ...

CSS/HTML code for creating a dynamic border on specific pages

Currently, I am working on creating a border button that becomes active when you are on the corresponding page. The challenge is that when you click on a different border button, the first one's border disappears and the second one becomes visible ins ...

Can Webpack be used to produce only CSS files without generating the output.js file?

I've integrated Webpack into my project alongside the extract-text-webpack-plugin. Within my project, I have various build scripts. One of these scripts focuses solely on bundling and minifying CSS. While utilizing Webpack for other tasks, I decided ...

JavaScript failing to validate radio button option

There seems to be an issue with the script not properly checking the radio button during testing. <script type="text/javascript"> function checkButton(){ if(document.getElementById('Revise').checked = true){ a ...