The border radius and table borders are causing the border to protrude noticeably on the right side

After much trial and error, I have almost successfully created a table with rounded corners on all four sides. The only issue is that in order for the radius property to work, I had to remove the table border property.

This resulted in the td border sticking out on the right-hand side. My goal is to achieve a smooth, even border on both the right and left sides with a width between 1-5 pixels.

I attempted to use a border-box div outside of my table, but unfortunately, I couldn't get it to work as intended. Here is what I currently have - note the right border sticks out by 1 pixel:

<html>
<style>
    table { 
        border-collapse: collapse;
        max-width: 560;
    }
    
    th.top_curved{ 
        border-top-right-radius: 20px;
        border-top-left-radius: 20px;
    }

    th.bottom_curved{ 
        border-bottom-right-radius: 20px;
        border-bottom-left-radius: 20px;
    }

    th{
        background-color: purple;
        color: white;
    }

    td{
        border: 1px solid purple;
    }
</style>
<body>
    <table style="table-layout: fixed; width: 100%">
        <colgroup>
            <col style="width: 80px;">
            <col style="width: 80px;">
            <col style="width: 80px;">
            <col style="width: 80px">
            <col style="width: 80px">
            <col style="width: 80px">
            <col style="width: 80px">
        </colgroup>
        <tr>
            <th class="top_curved" colspan="7">
                HEADER ROW
            </th>
        </tr>
        <tr>
            <th class="sub_header">Course</th>
            <th class="sub_header">Assignment</th>
            <th class="sub_header">Assigned</th>
            <th class="sub_header">Due</th>
            <th class="sub_header">Status</th>
            <th class="sub_header">Grade</th>
            <th class="sub_header">Comments</th>
        </tr>
        <tr>
            <td>a</td>
            <td>a</td>
            <td>a</td>
            <td>a</td>
            <td>a</td>
            <td>a</td>
            <td>a</td>
        </tr>
        <tr>
        <th class="bottom_curved" colspan="7">
            HEADER ROW
        </th>
        </tr>
    </table>
</body>
</html>

https://jsfiddle.net/o018wpvx/1/

Answer №1

Solved the puzzle.

The solution is to disable the border-collapse attribute and set the border spacing to 0:

table { 
    border-spacing: 0;
    max-width: 560;
}

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

Real-Time Chat Update Script

Recently, I've been delving into PHP and attempting to create a live chat web application. The data for the chat is stored in a MySQL database, and I have written a function called UpdateDb() that refreshes the chat content displayed in a certain div ...

Uncovering the Power of Shadow DOM within HTML

Lately, I've noticed a lot of buzz surrounding Shadow DOM. During a video I watched about the launch of Angular 2, the speaker kept mentioning Shadow DOM without much explanation. Can someone clarify what exactly Shadow DOM refers to? ...

I'm looking to add a price ticker to my html webpage. Does anyone know how to do this?

PHP Code <?php $url = "https://www.bitstamp.net/api/ticker/"; $fgc = file_get_contents($url); $json = json_decode($fgc, true); $price = $json["last"]; $high = $json["high"]; $low = $json["low"]; $date = date("m-d-Y - h:i:sa"); $open = $json["open"]; ...

Tips for adjusting VBA script in Excel to work with an Access database table

I received this code from a skilled user who prefers to remain anonymous. The code is designed to search the HTML content for innerText of specific tags and transfer them to an Excel table, well organized under headers, structured as a pivot. Public Sub Ge ...

using mixins with styled-components

I have encountered a challenge while attempting to pass a mixin from Material UI to a styled-component. The problem lies in finding a way to transfer the mixin value to the styled-component without having to assign it to a css property. Unfortunately, dire ...

Is the Navbar moving off-center and the Bootstrap sign-in demo looking funky on Flask? Need any solutions?

The positioning of the Navbar has been altered to the left, causing distortion in the login items, which is an example of Bootstrap implementation. In my login.html file, I have utilized the Bootstrap sign-in example. Strangely, only on this specific page ...

Creating a table with a static first column and vertical text positioned to the left of the fixed column

To create a table with the first column fixed, refer to this fiddle link: http://jsfiddle.net/Yw679/6/. You also need a vertical text to be positioned to the left of the fixed column in a way that it remains fixed like the first column. The disparities be ...

What is the best way to arrange two divs inside a main div so they remain fixed in place at all times?

Struggling with aligning two smaller divs within a main wrapper for my website. Despite confining them to the main div, they don't stay fixed or aligned properly. How can this issue persist even when contained within a main div? I've attempted s ...

Next.js threw a wrench in my plans when the HTML syntax was completely disrupted upon saving the index.js

I have encountered an issue in my VSCode environment while working on a next.js project. Whenever I attempt to save the index.js file, the HTML syntax crashes. I am at a loss on how to resolve this issue, so any assistance would be greatly appreciated. Tha ...

Enhancing the appearance of standard HTML checkboxes

This HTML snippet displays a pair of checkboxes positioned side by side <div id="mr_mrs"> <ul class="mr_mrs form-no-clear"> <li id="mr" class="popular-category"> <label for="Mr" id="mr">Mr</label> ...

What is the best way to add a textfield within an image?

Does anyone have a code snippet that can generate a "search box" like the one on www.dx.com? I was shocked to find that searching for "textfield inside image" only yielded results for "image inside textfield". ...

How to align scrolling images with their scroll origin - a step by step guide

Curious to know the name of the effect where images scroll in a different orientation than the page, creating a 2D appearance. Take a look at the Google Nexus website and scroll down - do you see the effect? What is this effect called? Is it created usin ...

The image in drag and drop ghost preview is not appearing on Firefox

I want to show a ghost element instead of the default browser preview while dragging and dropping. However, in Firefox, the image inside the ghost element is not displayed during dragging. Oddly enough, if I drop it and then drag again, the image does appe ...

Initiate a fade-in/fade-out slider when the button is clicked

I have successfully developed a fadein/fadeout slider that automatically transitions between images. However, I am now looking to implement the functionality to manually play the slider by clicking on next/prev buttons. HTML <section class="wrapper"&g ...

Hovering over rounded corners is being blocked by transparent areas

I have a setup that resembles the following: http://jsfiddle.net/NhAuJ/ The issue arises when hovering near the edges of the circle because the square div blocks interaction with the background. I want to ensure that the circular div in the middle remain ...

Combining Versioning with BundleConfig.cs: A Comprehensive Guide

Encountering a recurring issue where changes made to CSS or Javascript files do not reflect in client browsers unless they manually refresh the page with ctrl+F5. This poses a challenge, especially in a school system with numerous users who may not be awar ...

Does text-underline qualify as a property in CSS?

My stylesheet includes a property called text-underline:none, and I'm wondering if it is a valid CSS property. Can you confirm this? ...

Struggling with implementing Vue.js for making a task list using Bootstrap 5

I'm trying to get the hang of Vue.js. I've been working on setting up a to-do list where users can input tasks, but I'm having trouble getting the list to display correctly when I define the method. It seems like my add() function isn't ...

When the AJAX function is called again, the previous loading process is interrupted, without the use of jQuery

I have created a function that loads a URL into an element, but it seems to be encountering issues when called repeatedly in a loop to load multiple elements. The current load operation stops prematurely: function loadDataFromURL(url, elementId) { var ...

Conceal rows in a table that are not selected using Jquery when the table has been loaded from a given URL

Below is the HTML code for an user search input field and the results table: <div class="input-group"> <input type="text" id="q" class="form-control" placeholder="Search for User"> <span class="input-group-btn"> ...