I have a table with cells that have a background-color. I'm trying to set the box-shadow for the thead, but the background of a cells in first column overlaps a shadow. I tried to set a different z-index values and position: relative, but to no avail.
.results-table {
width: 100%;
border-collapse: separate;
border-spacing: 0;
table-layout: fixed;
}
.results-table th,
.results-table td {
padding: 1em;
width: 96px;
border-left: 1px solid rgba(34, 36, 38, 0.1);
border-top: 1px solid rgba(34, 36, 38, 0.1);
}
.results-table thead {
box-shadow: 0 2px 2px 0 rgba(0,0,0,.14), 0 3px 1px -2px rgba(0,0,0,.2), 0 1px 5px 0 rgba(0,0,0,.12);
position: relative;
}
.results-table thead th {
background: #E0E0E0;
border-bottom: 1px solid rgba(34, 36, 38, 0.1);
}
.results-table tr:first-child td,
.results-table tr:first-child th {
border-top: none;
}
.results-table tr th:first-child,
.results-table tr td:first-child {
border-left: none;
}
.item-cell.item-cell {
width: 128px;
}
td.item-cell.item-cell {
background: lightgreen;
}
<table class="results-table">
<thead>
<tr>
<th class="item-cell">
Item
</th>
<th>
Package
</th>
<th>
Price
</th>
</tr>
</thead>
<tbody>
<tr>
<td class="item-cell">
Link 1
</td>
<td>Package 1</td>
<td>Price 1</td>
</tr>
<tr>
<td class="item-cell">
Link 2
</td>
<td>Package 2</td>
<td>Price 2</td>
</tr>
<tr>
<td class="item-cell">
Link 3
</td>
<td>Package 3</td>
<td>Price 3</td>
</tr>
</tbody>
</table>
By the way, a shadow works in Firefox, but does not work in other browsers.
Firefox [image]
Chrome, Opera, Edge, IE11 [image]
So how to implement a shadow for the thead?
Thanks.
add z-index negative on td
.results-table td{
position: relative;
z-index: -1;
}
You can change this :
box-shadow: 0 2px 2px 0 rgba(0,0,0,.14), 0 3px 1px -2px rgba(0,0,0,.2), 0 1px 5px 0 rgba(0,0,0,.12);
to this :
box-shadow: 0 2px 2px 0 rgba(0,0,0,.14), 0 3px 1px -2px rgba(0,0,0,.2), 0 1px 5px 0 rgba(0,0,0,.12);
-webkit-box-shadow: 0 2px 2px 0 rgba(0,0,0,.14), 0 3px 1px -2px rgba(0,0,0,.2), 0 1px 5px 0 rgba(0,0,0,.12);
-moz-box-shadow: 0 2px 2px 0 rgba(0,0,0,.14), 0 3px 1px -2px rgba(0,0,0,.2), 0 1px 5px 0 rgba(0,0,0,.12);
thumbs up for Answer # 2. But there is new solution for this old problem i.e clip-path
body {
background: #f7f7f7;
}
.container {
width: 500px;
}
.item {
background: #fff;
height: 50px;
box-shadow: inset 0 1px #000;
/* Solution # 1 Starts */
/* z-index: -1;
position:relative */
/* Solution # 1 Ends */
/* Solution # 2 Starts */
clip-path: inset(0 1px 1px);
/* Solution # 2 End */
}
.cell {
box-shadow: inset 0 -1px #000;
/* box-shadow: 0 1px #000; */
}
<div class="container">
<div class="cell">
<div class="item">ITEM 1</div>
<div class="item">ITEM 2</div>
<div class="item">ITEM 3</div>
</div>
</div>
Related
I want to modify the slider but I get this error:
Unknown property name
What am I doing wrong?
I am using chrome and my os is windows 7.
<head>
<body>
<div class="gene_controller width" data-original_value="0" data-name="width">
<p class="gene_name">width</p>
<div class="gene_slider">
<div class="gene_input_row"><img class="undo invisible" src="/image/reset.png" style="padding:1px;"><input class="number_input slider-input" type="number" value="0" step="0.1"><img class="x" src="icons/scroll.svg"></div>
<div class="slider"><input type="range" min="-2" max="2" step="any" value="0"></div>
</div>
<!--document.getElementsByClassName("slider")[0].children[0].min
esto es un comentario en html
-->
<style>
input[type="range"] {
-webkit-appearance: none;
width: 100%;
background: transparent;
&:focus {
outline: none;
}
&::-webkit-slider-thumb {
-webkit-appearance: none;
height: 21px;
width: 11px;
background: svg-load(".\icons\indicator-horizontal.svg");
transform: translateY(-8px);
}
&::-moz-range-thumb {
height: 41px;
width: 11px;
border: 0;
border-radius: 0;
background: svg-load(".\icons\indicator-horizontal.svg");
transform: translateY(2px);
}
&::-webkit-slider-runnable-track {
width: 100%;
height: 2px;
box-sizing: border-box;
background: black;
border-right: 1px solid grey;
border-bottom: 1px solid grey;
box-shadow: 1px 0 0 white, 1px 1px 0 white, 0 1px 0 white, -1px 0 0 darkgrey, -1px -1px 0 darkgrey,
0 -1px 0 darkgrey, -1px 1px 0 white, 1px -1px darkgrey;
}
&::-moz-range-track {
width: 100%;
height: 2px;
box-sizing: border-box;
background: black;
border-right: 1px solid grey;
border-bottom: 1px solid grey;
box-shadow: 1px 0 0 white, 1px 1px 0 white, 0 1px 0 white, -1px 0 0 darkgrey, -1px -1px 0 darkgrey,
0 -1px 0 darkgrey, -1px 1px 0 white, 1px -1px darkgrey;
}
}
</style>
</div>
Your path is not correct, use this format:
./icons/indicator-horizontal.svg
for more examples check this link:
https://www.coffeecup.com/help/articles/absolute-vs-relative-pathslinks/
I believe you are using background: svg-load(".\icons\indicator-horizontal.svg"); property wrongly.
Simply try with background: url(".\icons\indicator-horizontal.svg"); everywhere you using background property.
Make sure you use the correct url relative path w.r.t your CSS file.
convert your scss to css
input[type="range"]{
-webkit-appearance:none;width:100%;background:transparent
}
input[type="range"]:focus{
outline:none
}
input[type="range"]::-webkit-slider-thumb{
-webkit-appearance:none;
height:21px;
width:11px;
background:svg-load(".iconsindicator-horizontal.svg");
-webkit-transform:translateY(-8px);
transform:translateY(-8px)}
input[type="range"]::-moz-range-thumb{
height:41px;
width:11px;
border:0;
border-radius:0;
background:svg-load(".iconsindicator-horizontal.svg");
transform:translateY(2px)}
input[type="range"]::-webkit-slider-runnable-track{
width:100%;
height:2px;
box-sizing:border-box;
background:black;
border-right:1px solid grey;
border-bottom:1px solid grey;
box-shadow:1px 0 0 white, 1px 1px 0 white, 0 1px 0 white, -1px 0 0 darkgrey, -1px -1px 0 darkgrey, 0 -1px 0 darkgrey, -1px 1px 0 white, 1px -1px darkgrey
}
input[type="range"]::-moz-range-track{
width:100%;
height:2px;
box-sizing:border-box;
background:black;
border-right:1px solid grey;
border-bottom:1px solid grey;
box-shadow:1px 0 0 white, 1px 1px 0 white, 0 1px 0 white, -1px 0 0 darkgrey, -1px -1px 0 darkgrey, 0 -1px 0 darkgrey, -1px 1px 0 white, 1px -1px darkgrey
}
<div class="gene_controller width" data-original_value="0" data-name="width">
<p class="gene_name">width</p>
<div class="gene_slider">
<div class="gene_input_row"><img class="undo invisible" src="/image/reset.png" style="padding:1px;"><input class="number_input slider-input" type="number" value="0" step="0.1"><img class="x" src="icons/scroll.svg"></div>
<div class="slider"><input type="range" min="-2" max="2" step="any" value="0"></div>
</div>
<!--document.getElementsByClassName("slider")[0].children[0].min
esto es un comentario en html
-->
</div>
I created table and I want to change it's position. At this point, I can't change position at all, so I believe direction doesn't matter. I've tried margin and padding on .first_table(I gave table this class), but it doesn't work at all. I tried changing display property as well as position property, but they didn't work either. They only worsened the situation. Though it is possible that those two properties only worsened the situation because I couldn't use them properly. Here are css and html codes of table:
.first_table{
color: #ad0720;
}
.first_table th h1 {
font-weight: bold;
font-size: 1em;
text-align: left;
color: #ad0720;
}
.first_table td {
font-weight: normal;
font-size: 1em;
-webkit-box-shadow: 0 2px 2px -2px #0E1119;
-moz-box-shadow: 0 2px 2px -2px #0E1119;
box-shadow: 0 2px 2px -2px #0E1119;
}
.first_table {
text-align: left;
overflow: hidden;
width: 50%;
margin: 50 50;
display: table;
padding-bottom: 50px;
}
.first_table td, .first_table th {
padding-bottom: 2%;
padding-top: 2%;
padding-left: 2%;
}
.first_table tr:nth-child(odd) {
background-color: #323C50;
}
.first_table tr:nth-child(even) {
background-color: #2C3446;
}
.first_table th {
background-color: #1F2739;
}
.first_table td:first-child {
color: #FB667A;
}
.first_table tr:hover {
background-color: #464A52;
-webkit-box-shadow: 0 6px 6px -6px #0E1119;
-moz-box-shadow: 0 6px 6px -6px #0E1119;
box-shadow: 0 6px 6px -6px #0E1119;
}
.first_table td:hover {
background-color: #FFF842;
color: #403E10;
font-weight: bold;
box-shadow: #7F7C21 -1px 1px, #7F7C21 -2px 2px, #7F7C21 -3px 3px, #7F7C21 -4px 4px, #7F7C21 -5px 5px, #7F7C21 -6px 6px;
transform: translate3d(6px, -6px, 0);
transition-delay: 0s;
transition-duration: 0.4s;
transition-property: all;
transition-timing-function: line;
}
#media (max-width: 800px) {
.container td:nth-child(4),
.container th:nth-child(4) {
display: none;
}
}
<table class="first_table">
<thead>
<tr>
<th>უნარები</th>
<td>Python</td>
<td>Web Development</td>
<td>Red Hat/CentOS</td>
<td>Algorithms & Data Structures</td>
</tr>
</thead>
<tbody>
<tr>
<th>შეფასება</th>
<td>⭐⭐⭐</td>
<td>⭐,⭐/2</td>
<td>⭐</td>
<td>⭐⭐⭐</td>
</tr>
</tbody>
</table>
Wrap the table in a <div> with an id or class, then add to it a position:relative and margin/padding. Tested, works.
In a table I'm making, whenever a cell has just a bit of content, a gap appears between the td and the div - it looks normal, though, when there a lot of things inside. This looks weird. Can someone help me remove it?
html:
<td cod='[#cod]'>
<div class="headler">
[#inicio] - [#fim]
</div>
<div class="valores_resultados">
<div class="disciplina" cod="[#cod_disciplina]">
[#disciplina]
</div>
<br>
<div class="professor" cod="[#cod_prof]">
[#professor]
</div>
</div>
css:
table {
border-spacing: 10px;;
border-collapse: separate;
width: 100%;
}
tr, td, th {
border: #000 solid 1px;
-webkit-box-shadow: 3px 2px 0px 0px rgba(0, 0, 0, 0.45);
-moz-box-shadow: 3px 2px 0px 0px rgba(0, 0, 0, 0.45);
box-shadow: 3px 2px 0px 0px rgba(0, 0, 0, 0.45);
}
td:hover {
border: rgb(80, 0, 0) solid 1px;
cursor:pointer;
-webkit-box-shadow: 3px 2px 0px 0px rgba(80, 0, 0, 0.45);
-moz-box-shadow: 3px 2px 0px 0px rgba(80, 0, 0, 0.45);
box-shadow: 3px 2px 0px 0px rgba(80, 0, 0, 0.45);
}
.headler {
background-color: rgb(145, 0, 0);
text-align: center;
padding: 4% 0%;
margin: 0;
}
.valores_resultados{
min-height: 60px;
text-align: center;
}
.disciplina {
margin-top: 3%;
}
.professor {
margin-bottom: 4%;
}
Change your CSS to:
table {
border-collapse: collapse;
}
Add this:
tr, td, th {vertical-align:top;}
Hello i am trying to spawn boxes side by side i dont know what to do i have tried
using Float:left; but that also didnt work
here is my css code
<style>
div.heh
{
width:550px;
height:200px;
border:1px solid black;
background-color: #f5f5f5;
border: .5px solid #e3e3e3;
border-radius: 1px;
padding: 19px;
margin-bottom: 5px;
min-height: 10px;
-webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.05);
box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.05);
box-align:left
float:left;
}
div.hehh
{
width:550px;
height:200px;
border:1px solid black;
background-color: #f5f5f5;
border: .5px solid #e3e3e3;
border-radius: 1px;
padding: 19px;
margin-bottom: 5px;
min-height: 10px;
-webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.05);
box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.05);
box-align:right
float:right;
}
</style>
<!------- here is the HTML Structure ----->
<div class="heh" align="left">
<h3>SteamRep:<button type="button" class="btn btn-default" >Normal</button><br>
View Backpack<br>
View TF2Outpost
</h3>
</div>
<div class="hehh">
<h3>Positive Reputation:<font color="green">100</font><br>
Negative Reputation:<font color="red">1</font></br>
Total Raffles Participated:<font color="green">12</font><br>
Warnings Received:<font color="red">0</font><br>
</h3>
</div>
In the above code the boxes would spawn below each other i dont know what is going wrong i have searched elsewhere also didnt find much resources here is the image
This Css method will also help you to make responsive Web site and reduce code redundancy in css.
Html
<div class="heh" align="left">
<h3>SteamRep:<button type="button" class="btn btn-default" >Normal</button><br>
View Backpack<br>
View TF2Outpost
</h3>
</div>
<div class="heh last">
<h3>Positive Reputation:<font color="green">100</font><br>
Negative Reputation:<font color="red">1</font></br>
Total Raffles Participated:<font color="green">12</font><br>
Warnings Received:<font color="red">0</font><br>
</h3>
</div>
Css
div.heh
{
float:left;
width:42%;
height:200px;
border:1px solid black;
background-color: #f5f5f5;
border: 5px solid #e3e3e3;
border-radius: 1px;
padding: 19px;
margin-bottom: 5px;
min-height: 10px;
-webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.05);
box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.05);
box-align:left
float:left;
margin-right:5px;
}
.heh.last{margin:0 !important;}
float:left; is the way to go, but I assume they don't fit next to each other in their parent container. Consequently, they want to be next to each other, but since that is impossible, they will display beneath each other.
So you need to make the parent container wider, or the child divs smaller.
reduce the width for both div and use width:200px;
it will be working
Just add display:inline-block to two div css classes
Each div size is 550px so if screen size is above 1100px only display side by side
CSS
div.heh
{
width:550px;
height:200px;
border:1px solid black;
background-color: #f5f5f5;
border: .5px solid #e3e3e3;
border-radius: 1px;
padding: 19px;
margin-bottom: 5px;
min-height: 10px;
-webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.05);
box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.05);
box-align:left;
float:left;
display:inline-block
}
div.hehh
{
width:550px;
height:200px;
border:1px solid black;
background-color: #f5f5f5;
border: .5px solid #e3e3e3;
border-radius: 1px;
padding: 19px;
margin-bottom: 5px;
min-height: 10px;
-webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.05);
box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.05);
box-align:right;
float:right;
display:inline-block
}
Fiddle
I want to add a border radius around the entire table. But the following code is not working in both the latest versions of Firefox and Google Chrome.
table {
border-spacing: 0;
width: 600px;
margin: 30px;
border: 1px solid #CCCCCC;
border-radius: 6px 6px 6px 6px;
-moz-border-radius: 6px 6px 6px 6px;
-webkit-border-radius: 6px 6px 6px 6px;
box-shadow: 0 1px 1px #CCCCCC;
}
table th:first-child {
border-radius: 6px 0 0 0;
-moz-border-radius: 6px 0 0 0;
-webkit-border-radius: 6px 0 0 0;
}
table th:last-child {
border-radius: 0 6px 0 0;
-moz-border-radius: 0 6px 0 0;
-webkit-border-radius: 0 6px 0 0;
}
table td:first-child,
.bordered th:first-child {
border-left: medium none;
}
table th {
background-color: #DCE9F9;
background-image: -moz-linear-gradient(center top, #F8F8F8, #ECECEC);
background-image: -webkit-gradient(linear, 0 0, 0 bottom, from(#F8F8F8), to(#ECECEC), color-stop(.4, #F8F8F8));
border-top: medium none;
box-shadow: 0 1px 0 rgba(255, 255, 255, 0.8) inset;
text-shadow: 0 1px 0 rgba(255, 255, 255, 0.5);
}
table td,
table th {
border-left: 1px solid #CCCCCC;
border-top: 1px solid #CCCCCC;
padding: 10px;
text-align: left;
}
<table class="bordered">
<thead>
<tr>
<th><label>Labels</label></th>
<th><label>Labels</label></th>
<th><label>Labels</label></th>
<th><label>Labels</label></th>
<th><label>Labels</label></th>
</tr>
</thead>
<tbody>
<tr>
<td><label>Value</label></td>
<td><label>Value</label></td>
<td><label>Value</label></td>
<td><label>Value</label></td>
<td><label>Value</label></td>
</tr>
</tbody>
</table>
JSFiddle
border-collapse: separate !important; worked.
Thanks.
HTML
<table class="bordered">
<thead>
<tr>
<th><label>Labels</label></th>
<th><label>Labels</label></th>
<th><label>Labels</label></th>
<th><label>Labels</label></th>
<th><label>Labels</label></th>
</tr>
</thead>
<tbody>
<tr>
<td><label>Value</label></td>
<td><label>Value</label></td>
<td><label>Value</label></td>
<td><label>Value</label></td>
<td><label>Value</label></td>
</tr>
</tbody>
</table>
CSS
table {
border-collapse: separate !important;
border-spacing: 0;
width: 600px;
margin: 30px;
}
.bordered {
border: solid #ccc 1px;
-moz-border-radius: 6px;
-webkit-border-radius: 6px;
border-radius: 6px;
-webkit-box-shadow: 0 1px 1px #ccc;
-moz-box-shadow: 0 1px 1px #ccc;
box-shadow: 0 1px 1px #ccc;
}
.bordered tr:hover {
background: #ECECEC;
-webkit-transition: all 0.1s ease-in-out;
-moz-transition: all 0.1s ease-in-out;
transition: all 0.1s ease-in-out;
}
.bordered td, .bordered th {
border-left: 1px solid #ccc;
border-top: 1px solid #ccc;
padding: 10px;
text-align: left;
}
.bordered th {
background-color: #ECECEC;
background-image: -webkit-gradient(linear, left top, left bottom, from(#F8F8F8), to(#ECECEC));
background-image: -webkit-linear-gradient(top, #F8F8F8, #ECECEC);
background-image: -moz-linear-gradient(top, #F8F8F8, #ECECEC);
background-image: linear-gradient(top, #F8F8F8, #ECECEC);
-webkit-box-shadow: 0 1px 0 rgba(255,255,255,.8) inset;
-moz-box-shadow:0 1px 0 rgba(255,255,255,.8) inset;
box-shadow: 0 1px 0 rgba(255,255,255,.8) inset;
border-top: none;
text-shadow: 0 1px 0 rgba(255,255,255,.5);
}
.bordered td:first-child, .bordered th:first-child {
border-left: none;
}
.bordered th:first-child {
-moz-border-radius: 6px 0 0 0;
-webkit-border-radius: 6px 0 0 0;
border-radius: 6px 0 0 0;
}
.bordered th:last-child {
-moz-border-radius: 0 6px 0 0;
-webkit-border-radius: 0 6px 0 0;
border-radius: 0 6px 0 0;
}
.bordered th:only-child{
-moz-border-radius: 6px 6px 0 0;
-webkit-border-radius: 6px 6px 0 0;
border-radius: 6px 6px 0 0;
}
.bordered tr:last-child td:first-child {
-moz-border-radius: 0 0 0 6px;
-webkit-border-radius: 0 0 0 6px;
border-radius: 0 0 0 6px;
}
.bordered tr:last-child td:last-child {
-moz-border-radius: 0 0 6px 0;
-webkit-border-radius: 0 0 6px 0;
border-radius: 0 0 6px 0;
}
jsFiddle
It works, this is a problem with the tool used: normalized CSS by jsFiddle is causing the problem by hiding you the default of browsers...
See http://jsfiddle.net/XvdX9/5/
EDIT:
normalize.css stylesheet from jsFiddle adds the instruction border-collapse: collapse to all tables and it renders them completely differently in CSS2.1:
The separated borders model
The collapsing border model
Differences between the 2 models can be seen in this other fiddle: http://jsfiddle.net/XvdX9/11/ (with some transparencies on cells and an enormous border-radius on the top-left one, in order to see what happens on table vs its cells)
In the same CSS2.1 page about HTML tables, there are also explanations about what browsers should/could do with empty-cells in the separated borders model, the difference between border-style: none and border-style: hidden in the collapsing borders model, how width is calculated and which border should display if both table, row and cell elements define 3 different styles on the same border.
This is my solution using the wrapper, just removing border-collapse might not be helpful always, because you might want to have borders.
.wrapper {
overflow: auto;
border-radius: 6px;
border: 1px solid red;
}
table {
border-spacing: 0;
border-collapse: collapse;
border-style: hidden;
width:100%;
max-width: 100%;
}
th, td {
padding: 10px;
border: 1px solid #CCCCCC;
}
<div class="wrapper">
<table>
<thead>
<tr>
<th>Column 1</th>
<th>Column 2</th>
<th>Column 3</th>
</tr>
</thead>
<tbody>
<tr>
<td>Foo Bar boo</td>
<td>Lipsum</td>
<td>Beehuum Doh</td>
</tr>
<tr>
<td>Dolor sit</td>
<td>ahmad</td>
<td>Polymorphism</td>
</tr>
<tr>
<td>Kerbalium</td>
<td>Caton, gookame kyak</td>
<td>Corona Premium Beer</td>
</tr>
</tbody>
</table>
</div>
This article helped: https://css-tricks.com/table-borders-inside/
A note to this old question:
My reset.css had set border-spacing: 0, causing the corners to get cut off. I had to set it to 3px for my radius to work properly (value will depend on the radius in question).
Just add overflow:hidden to the table with border-radius.
.tablewithradius {
overflow:hidden ;
border-radius: 15px;
}
<div class="leads-search-table">
<div class="row col-md-6 col-md-offset-2 custyle">
<table class="table custab bordered">
<thead>
<tr>
<th>ID</th>
<th>Title</th>
<th>Parent ID</th>
<th class="text-center">Action</th>
</tr>
</thead>
<tr>
<td>1</td>
<td>News</td>
<td>News Cate</td>
<td class="text-center"><a class='btn btn-info btn-xs' href="#"><span class="glyphicon glyphicon-edit"></span> Edit</a> <span class="glyphicon glyphicon-remove"></span> Del</td>
</tr>
<tr>
<td>2</td>
<td>Products</td>
<td>Main Products</td>
<td class="text-center"><a class='btn btn-info btn-xs' href="#"><span class="glyphicon glyphicon-edit"></span> Edit</a> <span class="glyphicon glyphicon-remove"></span> Del</td>
</tr>
<tr>
<td>3</td>
<td>Blogs</td>
<td>Parent Blogs</td>
<td class="text-center"><a class='btn btn-info btn-xs' href="#"><span class="glyphicon glyphicon-edit"></span> Edit</a> <span class="glyphicon glyphicon-remove"></span> Del</td>
</tr>
</table>
</div>
</div>
Css
.custab{
border: 1px solid #ccc;
margin: 5% 0;
transition: 0.5s;
background-color: #fff;
-webkit-border-radius:4px;
border-radius: 4px;
border-collapse: separate;
}
No need to worry..Just add
overflow: hidden;
and then apply border radius. Border radius will be applied to all the four sides.
To use border radius I have a border radius of 20px in the table, and then put the border radius on the first child of the table header (th) and the last child of the table header.
table {
border-collapse: collapse;
border-radius:20px;
padding: 10px;
}
table th:first-child {
/* border-radius = top left, top right, bottom right, bottom left */
border-radius: 20px 0 0 0; /* curves the top left */
padding-left: 15px;
}
table th:last-child {
border-radius: 0 20px 0 0; /* curves the top right */
}
This however will not work if this is done with table data (td) because it will add a curve onto each table row. This is not a problem if you only have 2 rows in your table but any additional ones will add curves onto the inner rows too.
You only want these curves on the outside of the table.
So for this, add an id to your last row.
Then you can apply the curves to them.
/* curves the first tableData in the last row */
#lastRow td:first-child {
border-radius: 0 0 0 20px; /* bottom left curve */
}
/* curves the last tableData in the last row */
#lastRow td:last-child {
border-radius: 0 0 20px 0; /* bottom right curve */
}