1px border issue not displaying - html

I'm trying to highlight a specific product on the comparison table. The highlight color is Red but i'm having issues when using 1px, but when i use 2px it works fine but 2px is to big.
Also noticed on this code snippet it does not display RED borders after i have added bootstrap, so attaching a screenshot.
My goal is to have Selected Product to be surrounded by RED 1px border. Also i would not mind any other tips of displaying these types of table.
I have also tried this but did not work: https://muffinman.io/fix-for-chrome-not-rendering-borders/
Also looks like this is not Bootstrap issue, if i remove the BS and use border-collapse: collapse; same problem
.table {
margin: 20px;
display: inline-block;
text-align: center;
}
table,
th,
td {
border: 1px solid #ddd;
padding: 10px;
}
th:not(:first-child) {
width: 200px;
}
table,
th {
font-weight: normal;
}
.border-sides {
border-right: 1px solid red !important;
border-left: 1px solid red !important;
}
.border-top {
border-top: 1px solid red !important;
}
.border-bottom {
border-bottom: 1px solid red !important;
}
.bg-selected {
background-color: #b3c2ff;
}
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css" rel="stylesheet"/>
<div class="table">
<table>
<thead>
<tr>
<th></th>
<th>
<div class="text-left">
<span>Title - Product 1 Test</span>
</div>
</th>
<th class="border border-top">
<div class="text-left">
<span class="font-weight-bold">Selected Product:</span>
<span>Title - Product 2</span>
</div>
</th>
<th>
<div class="text-left">
<span>Title - Product 2</span>
</div>
</th>
</tr>
</thead>
<tbody>
<tr>
<td></td>
<td>
<button class="btn btn-primary">View</button>
</td>
<td class="border border-sides">
<button class="btn btn-primary">Buy now</button>
</td>
<td>
<button class="btn btn-primary">View</button>
</td>
</tr>
<tr class="text-left">
<td>Description 1</td>
<td>Y</td>
<td class="border bg-selected">N</td>
<td>N</td>
</tr>
<tr class="text-left">
<td class="test">Description 2</td>
<td>N</td>
<td class="border bg-selected">N</td>
<td>N</td>
</tr>
<tr>
<td></td>
<td>
<button class="btn btn-primary">View</button>
</td>
<td class="border border-bottom">
<button class="btn btn-primary">Buy now</button>
</td>
<td>
<button class="btn btn-primary">View</button>
</td>
</tr>
</tbody>
</table>
</div>
Also double checked my BS is running first then my CSS or i'm missing something?

Is this the desired ouput?
UPDATED
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css" rel="stylesheet" />
<style>
.table {
margin: 20px;
display: inline-block;
text-align: center;
}
table,
.table thead th,
.table td {
border: 1px solid #ddd;
border-collapse: separate;
border-spacing: 0px;
padding: 10px;
}
table {
padding: 0;
border-width: 0 2px 0 0.5px;
}
th:not(:first-child) {
width: 200px;
}
table,
th {
font-weight: normal;
}
.table thead th{
border-top-width: 1px;
}
.table tr:last-child td{
border-bottom-width: 1px;
}
.table thead th, .table td{
border-right: none;
}
.border-sides {
border-right: 1px solid red !important;
border-left: 1px solid red !important;
}
.border-sides + td, .table thead .border-sides + th{
border-left: none;
}
.border-top {
border-top: 1px solid red !important;
}
.border-bottom {
border-bottom: 1px solid red !important;
}
.bg-selected {
background-color: #b3c2ff;
}
</style>
<div class="table">
<table>
<thead>
<tr>
<th></th>
<th>
<div class="text-left">
<span>Title - Product 1 Test</span>
</div>
</th>
<th class="border border-top border-sides">
<div class="text-left">
<span class="font-weight-bold">Selected Product:</span>
<span>Title - Product 2</span>
</div>
</th>
<th>
<div class="text-left">
<span>Title - Product 2</span>
</div>
</th>
</tr>
</thead>
<tbody>
<tr>
<td></td>
<td>
<button class="btn btn-primary">View</button>
</td>
<td class="border border-sides">
<button class="btn btn-primary">Buy now</button>
</td>
<td>
<button class="btn btn-primary">View</button>
</td>
</tr>
<tr class="text-left">
<td>Description 1</td>
<td>Y</td>
<td class="border bg-selected border-sides">N</td>
<td>N</td>
</tr>
<tr class="text-left">
<td class="test">Description 2</td>
<td>N</td>
<td class="border border-sides bg-selected">N</td>
<td>N</td>
</tr>
<tr>
<td></td>
<td>
<button class="btn btn-primary">View</button>
</td>
<td class="border border-bottom border-sides">
<button class="btn btn-primary">Buy now</button>
</td>
<td>
<button class="btn btn-primary">View</button>
</td>
</tr>
</tbody>
</table>
</div>

You can add td for your rule, for example td.border-top then it makes it more specific then the BS rule and overrides it

Related

How to make arbitrary "sections" of a table in HTML that are correctly spaced?

I am having trouble making a table which has arbitrarily sectioned off parts (by using borders on certain cells). I really can't explain this much better besides just showing you what I mean. I tried using a div in each table cell which had a left and right padding value of 10px, but this causes other problems. You will see what I am trying to do and why there are problems here:
table {
border: 2px solid black
}
th {
background-color: white;
}
td, th {
padding: 2px
}
tr:nth-child(even) {
background-color: rgba(200, 200, 200, 0.6);
}
td {
padding-left: 10px;
padding-right: 10px;
}
td .inner {
margin: -1px 0px;
}
.inner {
padding: 2px;
}
<table style="border-collapse: collapse;">
<tr>
<th style="border: 2px solid black;" rowspan="2">
Header
</th>
<th colspan="3">
Header #2
</th>
</tr>
<tr>
<td style="border: 2px solid black; background-color: white;" colspan="3">Header subtitle</td>
</tr>
<tr>
<th>Horizontal Header</th>
<td>
<div class="inner">
foo
</div>
</td>
<td style="border-bottom: 2px solid black;">
<div class="inner">
bar
</div>
</td>
<td style="border-bottom: 2px solid black;">
<div class="inner">
dog
</div>
</td>
</tr>
<tr>
<th style="border-bottom: 2px solid black;">Horizontal Header 2</th>
<td style="border-bottom: 2px solid black; border-right: 2px solid black;">
<div class="inner">
foo
</div>
</td>
<td>
<div class="inner">
bar
</div>
</td>
<td>
<div class="inner">
dog
</div>
</td>
</tr>
<tr>
<th style="border-bottom: 2px solid black;">Horizontal Header 3</th>
<td style="border-bottom: 2px solid black;">
<div class="inner">
foo
</div>
</td>
<td>
<div class="inner" style="border-left: 2px solid black; border-top: 2px solid black;">
bar
</div>
</td>
<td style="border-top: 2px solid black;">
<div class="inner">
dog
</div>
</td>
</tr>
<tr>
<th>Horizontal Header 4</th>
<td>
<div class="inner">
foo
</div>
</td>
<td>
<div class="inner">
bar
</div>
</td>
<td>
<div class="inner">
dog
</div>
</td>
</tr>
</table>
JSfiddle: https://jsfiddle.net/0f82dg4r/.

bootstrap- border top is adding a border to table

I created a table just like below:
As you can see the border top is not taking any changes although I did add it in the following code:
<div class="col-6 col-md-3 col-sm-6 font-style" style="font-size:10px;">
<table class="table table-outer-border font-style " >
<tbody class="font-style">
<tr >
<td>Receiver:</td>
</tr>
<tr>
<td>Attention To:</td>
</tr>
<tr>
<td>Contact No:</td>
</tr>
</tbody>
</table>
</div>
<div class="col-6 col-md-3 col-sm-6 font-style" style="font-size:10px;">
<table class="table table-outer-border font-style " >
<tbody class="font-style">
<tr >
<td>Deliver To:</td>
</tr>
<tr>
<td>Attention To:</td>
</tr>
<tr>
<td>Contact No:</td>
</tr>
</tbody>
</table>
</div>
Style:
.table-outer-border {
border-left: black solid;
border-right: black solid;
border-top: black solid ;
border-bottom: black solid;
border-width: thin;
}
Why is it not working and also is there a way to remove the lines between the rows?
There are couple of changes you need to do in your code, I have just made that for you, Kindly validate and let me know.
#MainDiv {
height: 100px;
width: 500px;
margin: 5px;
display: flex;
flex-direction: row;
font-size: 20px;
}
td {
width: 150px;
}
#firstDiv {
border: 1px solid black;
}
#secondDiv {
margin-left: 20px;
border: 1px solid black;
}
<div id="MainDiv">
<div id="firstDiv" class="col-6 col-md-3 col-sm-6 font-style">
<table class="table table-outer-border font-style ">
<tbody>
<tr>
<td>Receiver:</td>
<td></td>
</tr>
<tr>
<td>Attention To:</td>
<td></td>
</tr>
<tr>
<td>Contact No:</td>
<td></td>
</tr>
</tbody>
</table>
</div>
<div id="secondDiv" class="col-6 col-md-3 col-sm-6 font-style">
<table class="table table-outer-border font-style ">
<tbody class="font-style">
<tr>
<td>Deliver To:</td>
<td></td>
</tr>
<tr>
<td>Attention To:</td>
<td></td>
</tr>
<tr>
<td>Contact No:</td>
<td></td>
</tr>
</tbody>
</table>
</div>
</div>

How do I make td occupy 50% of tr

I have the following snippet. It has one problem - the Enter your passcode: td occupies too much space, and looks ugly.
I've tried to set width:50% to that, but it didn't work out.
What I'm trying to achieve is that the input field goes line in line to the Expertise Organization button.
How can I do that?
Thanks in advance.
.prettyEGRZButton {
width: 100%;
padding: 20px;
text-align: center;
text-decoration: none;
display: inline-block;
font-size: 16px;
margin: 4px 2px;
cursor: pointer;
border-radius: 12px;
border: 1px solid #05788d;
color: #05788d;
background: transparent;
}
.prettyEGRZButtonActive {
color: white;
background: #05788d;
}
<div id="view:_id1:egrzFinishAuthPopUp" class="egrzFinishAuthPopUp">
<div id="view:_id1:organizationsRepeat">
</div>
<div id="view:_id1:rolesRepeat">
</div>
<table id="view:_id1:egrzFinishAuthPopUpTable" role="presentation">
<tbody>
<tr align="center">
<td>
<span class="xspTextLabel">To proceed, please authorize</span>
</td>
</tr>
<tr align="center">
<td>
<span class="xspTextLabel">Authorize as natural person</span>
</td>
</tr>
<tr id="view:_id1:authAsPersonTr">
<td id="view:_id1:authAsPersonTd">
<button class="prettyEGRZButton" type="button" name="view:_id1:authAsPersonButton" id="view:_id1:authAsPersonButton">John Doe</button>
</td>
</tr>
<tr align="center">
<td>
<span class="xspTextLabel">Authorize as organization</span>
</td>
</tr>
<tr id="view:_id1:organizationsRepeat:0:authAsOrgTr">
<td id="view:_id1:organizationsRepeat:0:authAsOrgTd">
<button class="prettyEGRZButton" type="button" name="view:_id1:organizationsRepeat:0:authAsOrgButton" id="view:_id1:organizationsRepeat:0:authAsOrgButton">Company 1</button>
</td>
</tr>
<tr id="view:_id1:organizationsRepeat:1:authAsOrgTr">
<td id="view:_id1:organizationsRepeat:1:authAsOrgTd">
<button class="prettyEGRZButton prettyEGRZButtonActive" type="button" name="view:_id1:organizationsRepeat:1:authAsOrgButton" id="view:_id1:organizationsRepeat:1:authAsOrgButton">Company 2</button>
</td>
</tr>
<tr id="view:_id1:rolesRepeat:0:roleTr">
<td id="view:_id1:rolesRepeat:0:roleTd">
<button class="prettyEGRZButton" type="button" name="view:_id1:rolesRepeat:0:roleButton" id="view:_id1:rolesRepeat:0:roleButton">Government Organization</button>
</td>
</tr>
<tr id="view:_id1:rolesRepeat:1:roleTr">
<td id="view:_id1:rolesRepeat:1:roleTd">
<button class="prettyEGRZButton" type="button" name="view:_id1:rolesRepeat:1:roleButton" id="view:_id1:rolesRepeat:1:roleButton">Expertise Organization</button>
</td>
</tr>
<tr>
<td>
<span class="xspTextComputedField">Enter your passcode:</span>
</td>
<td>
<input id="view:_id1:inputText1" type="password" name="view:_id1:inputText1" value="" class="xspInputFieldSecret">
</td>
</tr>
</tbody>
</table>
</div>
Your first couple tr are one td only. So the bottom tr need to honor it. You can use two rows to make it align.
.prettyEGRZButton
{
width: 100%;
padding: 20px;
text-align: center;
text-decoration: none;
display: inline-block;
font-size: 16px;
margin: 4px 2px;
cursor: pointer;
border-radius: 12px;
border: 1px solid #05788d;
color: #05788d;
background: transparent;
}
.prettyEGRZButtonActive
{
color: white;
background: #05788d;
}
.xspInputFieldSecret{
width:100%;
}
<div id="view:_id1:egrzFinishAuthPopUp" class="egrzFinishAuthPopUp"><div id="view:_id1:organizationsRepeat">
</div><div id="view:_id1:rolesRepeat">
</div><table id="view:_id1:egrzFinishAuthPopUpTable" role="presentation"><tbody><tr align="center"><td><span class="xspTextLabel">To proceed, please authorize</span></td>
</tr>
<tr align="center"><td><span class="xspTextLabel">Authorize as natural person</span></td>
</tr>
<tr id="view:_id1:authAsPersonTr"><td id="view:_id1:authAsPersonTd"><button class="prettyEGRZButton" type="button" name="view:_id1:authAsPersonButton" id="view:_id1:authAsPersonButton">John Doe</button></td>
</tr>
<tr align="center"><td><span class="xspTextLabel">Authorize as organization</span></td>
</tr>
<tr id="view:_id1:organizationsRepeat:0:authAsOrgTr"><td id="view:_id1:organizationsRepeat:0:authAsOrgTd"><button class="prettyEGRZButton" type="button" name="view:_id1:organizationsRepeat:0:authAsOrgButton" id="view:_id1:organizationsRepeat:0:authAsOrgButton">Company 1</button></td>
</tr>
<tr id="view:_id1:organizationsRepeat:1:authAsOrgTr"><td id="view:_id1:organizationsRepeat:1:authAsOrgTd"><button class="prettyEGRZButton prettyEGRZButtonActive" type="button" name="view:_id1:organizationsRepeat:1:authAsOrgButton" id="view:_id1:organizationsRepeat:1:authAsOrgButton">Company 2</button></td>
</tr>
<tr id="view:_id1:rolesRepeat:0:roleTr"><td id="view:_id1:rolesRepeat:0:roleTd"><button class="prettyEGRZButton" type="button" name="view:_id1:rolesRepeat:0:roleButton" id="view:_id1:rolesRepeat:0:roleButton">Government Organization</button></td>
</tr>
<tr id="view:_id1:rolesRepeat:1:roleTr"><td id="view:_id1:rolesRepeat:1:roleTd"><button class="prettyEGRZButton" type="button" name="view:_id1:rolesRepeat:1:roleButton" id="view:_id1:rolesRepeat:1:roleButton">Expertise Organization</button></td>
</tr>
<tr><td><span class="xspTextComputedField">Enter your passcode:</span></td>
</tr><tr>
<td><input id="view:_id1:inputText1" type="password" name="view:_id1:inputText1" value="" class="xspInputFieldSecret"></td>
</tr>
</tbody></table>
</div>

IE displays table row border at times

In in IE 11 the table row is displaying a white line border even though it has border: none; This problem doesn't occur on firefox and chrome.
JSFiddle link
Image in IE:
Image in Chrome
After playing around with the code, I saw that the rounded corners cause this issue.
table.striped > tbody > tr > td:first-child {
border-radius: 10px 0 0 10px;
}
table.striped > tbody > tr > td:last-child {
border-radius: 0 10px 10px 0;
}
The IE can not take "border" when you use a "border_radius". With this "CSS", this issue is solved in the "IE"
table.striped>tbody>tr:nth-child(odd) > td
{
border-left: solid 1em #F2F2F2!important;
}
table.striped > tbody > tr > td.failed
{
border-left: solid 1em #FF4359!important;
}
table.striped>tbody>tr:nth-child(even) > td,
table.striped > tbody > tr > td:first-child
{
border-left: none!important;
}
#import 'https://fonts.googleapis.com/icon?family=Material+Icons';
.searchbox {
width: 0% !important;
}
.searchbox.open {
width:45% !important;
padding-left: 10px !important;
}
.searchicon {
cursor: pointer;
}
.failed {
background-color: #ff4359;
color: white;
}
.pad-l-15 {
padding-left: 15px;
}
body {
background-color: #F3F3F2;
}
table.striped > tbody > tr > td:first-child {
border-radius: 10px 0 0 10px;
}
table.striped > tbody > tr > td:last-child {
border-radius: 0 10px 10px 0;
}
#listcount {
font-size: 18px;
color: #727d93;
}
.icons {
margin-left: auto;
padding: 5px;
}
.card .card-content .card-title {
display: flex;
align-items: center;
}
table.striped>tbody>tr:nth-child(odd) > td
{
border-left: solid 1em #F2F2F2!important;
}
table.striped > tbody > tr > td.failed
{
border-left: solid 1em #FF4359!important;
}
table.striped>tbody>tr:nth-child(even) > td,
table.striped > tbody > tr > td:first-child
{
border-left: none!important;
}
<link href="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.99.0/css/materialize.min.css" rel="stylesheet"/>
<div class="row">
<div class="col s12 m6">
<div class="card">
<div class="card-content">
<span class="card-title">
<i class="material-icons">business_center</i>
My List
<span id="listcount">
(12)
</span>
<div class="icons">
<span class="new badge yellow" data-badge-caption="">
1
</span>
</div>
<input id="fund-search" type="search" class="searchbox" placeholder="Search">
<i class="material-icons right searchicon" ng-click="toggleSearch()">search</i>
</span>
<div class="">
<table class="table striped table-hover table-curved" ng-controller="Hello">
<tbody>
<tr>
<td class="pad-l-15"><b>12345</b></td>
<td>Random Text #</td>
<td><b>300121</b></td>
</tr>
<tr>
<td class="failed pad-l-15"><b>12345678</b></td>
<td class="failed">Random Text #</td>
<td class="failed"><b>300121</b></td>
</tr>
<tr>
<td class="pad-l-15"><b>123</b></td>
<td>Random Text #</td>
<td><b>300121</b></td>
</tr>
<tr>
<td class="pad-l-15"><b>123</b></td>
<td>Random Text #</td>
<td><b>300121</b></td>
</tr>
<tr>
<td class="pad-l-15"><b>123</b></td>
<td>Random Text #</td>
<td><b>300121</b></td>
</tr>
<tr>
<td class="pad-l-15"><b>123</b></td>
<td>Random Text #</td>
<td><b>300121</b></td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
<div class="col s12 m6">
<div class="card">
<div class="card-content">
<span class="card-title">My Right List
<span class="new badge red" data-badge-caption="">4</span>
</span>
<div class="table-responsive">
<table class="table striped table-hover table-curved" ng-controller="Hello">
<tbody>
<tr>
<td><b>12345</b></td>
<td>Random Text #</td>
<td><b>300121</b></td>
</tr>
<tr>
<td><b>12345678</b></td>
<td>Random Text #</td>
<td><b>300121</b></td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<div class="row">
<div class="col s12 m6">
<div class="card">
<div class="card-content">
<span class="card-title">Nested left</span>
</div>
</div>
</div>
<div class="col s12 m6">
<div class="card">
<div class="card-content">
<span class="card-title">Nested right</span>
</div>
</div>
</div>
</div>
</div>
</div>

getting only column borders using CSS

I've the below HTML Table. and her i want to get only first row border and the rest only column borders only. as given in the screenshot. please let me know how i can do it in my css.
<table cellspacing="1" class="topbotcol">
<thead>
<tr>
<th valign="middle" class="colsep rowsep" align="center">
<span class="font-style-bold">Item</span>
</th>
<th valign="middle" class="colsep rowsep" align="center"> </th>
<th valign="middle" class="colsep rowsep" align="center"> </th>
<th valign="middle" class="colsep rowsep" align="center">
<span class="font-style-bold">Qty</span>
</th>
<th valign="middle" class="colsep rowsep" align="center">
<span class="font-style-bold">Unit</span>
</th>
<th valign="middle" class="colsep rowsep" align="center">
<span class="font-style-bold">Rate $</span>
</th>
</tr>
</thead>
<tbody>
<tr>
<td class="rowsep" align="left"> </td>
<td class="rowsep" align="left">
<div class="para">BUILT-UP WATERPROOF MEMBRANE PANEL ROOFING TO FLAT ROOFS AND POOL DECK</div>
</td>
<td class="rowsep" align="center"> </td>
<td class="rowsep" align="center"> </td>
<td class="rowsep" align="center"> </td>
<td class="rowsep" align="center"> </td>
</tr>
<tr>
<td class="rowsep" align="left"> </td>
<td class="rowsep" align="left">
<div class="para">Preparing surfaces: priming and applying “Grims K1” slurry and “Grims Premier K10” waterproof membrane system as specified</div>
</td>
<td class="rowsep" align="center"> </td>
<td class="rowsep" align="center"> </td>
<td class="rowsep" align="center"> </td>
<td class="rowsep" align="center"> </td>
</tr>
<tr>
<td class="rowsep" align="left"> </td>
<td class="rowsep" align="left">
<div class="para">Membrane collars; pointing with epoxy; reinforced with clamp rings around flanges of rainwater outlets</div>
</td>
<td class="rowsep" align="center"> </td>
<td class="rowsep" align="center"> </td>
<td class="rowsep" align="center"> </td>
<td class="rowsep" align="center"> </td>
</tr>
<tr>
<td class="rowsep" align="left">
<div class="para">A</div>
</td>
<td class="rowsep" align="center">
<div class="para">200mm diameter</div>
</td>
<td class="rowsep" align="center">
<div class="para">13</div>
</td>
<td class="rowsep" align="center">
<div class="para">No.</div>
</td>
<td class="rowsep" align="center">
<div class="para">34.28</div>
</td>
<td class="rowsep" align="center">
<div class="para">445.64</div>
</td>
</tr>
</tbody>
</table>
Thanks
table {
border-top: 1px Solid Black;
border-left: 1px Solid Black;
border-bottom: 1px Solid Black;
border-spacing: 0;
}
th, td {
border-right: 1px Solid Black;
}
th {
background-color: lightgrey;
border-bottom: 1px Solid Black;
}
You can use pseudo classes here:
As your table has th for table headers then you can try this:
table.topbotcol tr:first-of-type{
border-bottom:1px solid #ccc; // Will apply border to first row
}
table.topbotcol tr:first-of-type td{
border:none; // will not apply border to tds of first row, and continue after first row
}
You haven't provided detailed description, i think this might help you!
Pseudo-Classes
Docs
:first-of-type
What you need to do is set a border and set the table border to collapse. This will merge the cell borders. Then remove the unwanted top and bottom borders.
table, th, td{
border: 1px solid #000;
}
table {
border-collapse: collapse;
}
td {
border-bottom: none;
border-top: none;
}
Here's a JSFiddle with a fuller example as well as some more optimizations.
Link to JS Fiddle
Suggestions:
don't use valign or align on table cells, use CSS vertical-align and text-align instead
use paragraph tags instead of <div class="para">
use class names that are descriptive of the content, not its style. This helps with maintenance later when you decide that you do not want something to be font-style-bold anymore. It is easier to change <th> in the CSS than it is to change it in the CSS and THEN go back and change ALL font-style-bold to font-style-normal in your HTML.
You can achieve that by setting the border on the td and th cells, but making the border-top and border-bottom none for the td, but then setting surrounding border of the entire table as well.
The following css is an example:
table {
border-collapse:collapse;
border: 1px solid #000;
}
th {
background-color: #ccc;
border-left: 1px solid #000;
border-bottom: 1px solid #000;
padding: 5px;
}
td {
border-left: 1px solid #000;
padding: 5px;
}
Link to JS Fiddle
Try this
http://jsfiddle.net/aYCjA/
.tbl {
border: 1px solid black;
border-collapse: collapse;
min-width: 300px;
text-align: center;
}
.tbl th, .tbl td {
padding: 2px 5px;
}
.tbl td {
border-left: 1px solid black;
border-right: 1px solid black;
}
.tbl th {
border: 1px solid black;
}
The important thing here is border-collapse: collapse. This attribute prevents showing duplicate borders in sibling cells.