I've got a news letter program that has a table with a border but I'm trying to make the border have rounded edges. For some reason when I add in "border-radius: 20px;" it doesn't work.
<table style="border-radius: 20px; order-color: #000000; border-width: 1px; width: 680px;" border="1" cellpadding="5" rules="none" align="center">
I cant have a separate style sheet. It just shows a standard square border. Maybe Im doing it wrong, Im not great at html.
By default, table is set to display: table;. Change that to display: block; and add border-collapse: seperate;
example:
<table style="border-radius: 20px; border-color: #000000; border-width: 1px; width: 680px; display: block; border-collapse: separate;" border="1" cellpadding="5" rules="none" align="center">
jsfiddle: http://jsfiddle.net/57we8/
Try this in your css:
-webkit-border-radius: 10px;
-moz-border-radius: 10px;
border-radius: 10px;
And then then consider including PIE.htc (http://css3pie.com/) or something similar for IE:
*behavior:url(PIE.htc); /* shows in IE7 and below */
_behavior:url(PIE.htc); /* shows in IE6 and below */
try this css
body {
margin: 30px;
}
table {
border-collapse: separate;
border-spacing: 0;
min-width: 350px;
}
table tr th,
table tr td {
border-right: 1px solid #bbb;
border-bottom: 1px solid #bbb;
padding: 5px;
}
table tr th:first-child,
table tr td:first-child {
border-left: 1px solid #bbb;
}
table tr th {
background: #eee;
border-top: 1px solid #bbb;
text-align: left;
}
/* top-left border-radius */
table tr:first-child th:first-child {
border-top-left-radius: 6px;
}
/* top-right border-radius */
table tr:first-child th:last-child {
border-top-right-radius: 6px;
}
/* bottom-left border-radius */
table tr:last-child td:first-child {
border-bottom-left-radius: 6px;
}
/* bottom-right border-radius */
table tr:last-child td:last-child {
border-bottom-right-radius: 6px;
}
Related
Border radius is not applied. I try to apply border-radius on tr tag but it's not working
<table align="center" border="0" cellspacing="0" cellpadding="0" width="80%" >
<h2>Let the borders collapse</h2>
<tr class="border">
<th class="side">Firstname</th>
<th>Lastname</th>
<th class="side">Lastname</th>
</tr>
</table>
</td></tr>
</table>
https://jsfiddle.net/p4wm06kg/3/
https://codepen.io/turbo_baguettes/pen/gOmzGNN
works fine for me
.border {
/* margin: auto; */
border-style: hidden;
border-spacing: 0;
overflow: auto;
border-collapse: separate !important;
/* border-spacing: 0; */
-moz-border-radius: 6px;
/* -webkit-border-radius: 6px; */
border-radius: 10px;
max-width: 100%;
/* border-right: none;
border-left: none; */
border-top-left-radius: 10px;
border-top-right-radius: 10px;
border-bottom-left-radius: 10px;
border-bottom-right-radius: 10px;
/* TR BORDER HERE */
border: 5px solid pink;
}
This question already has answers here:
Rounded table corners CSS only
(17 answers)
Closed 3 years ago.
How to round html table corners using css?
Table looks like this:
<table>
<tr>
<th colspan="2">header</th>
</tr>
<tr>
<td>data1</td>
<td>data2</td>
</tr>
</table>
Css:
th {
background-color: black;
color: white;
border: none;
}
table {
border-collapse: collapse;
border: 1px solid;
border-radius: 5px;
}
table tr:first-child th:first-child {
border-top-left-radius: 5px
}
table tr:first-child th:last-child {
border-top-right-radius: 5px
}
table tr:last-child td:first-child {
border-bottom-left-radius: 5px
}
table tr:last-child td:last-child {
border-bottom-right-radius: 5px
}
Only top right and left corners are rounded, but there is black border on them that isn't rounded. And bottom corners aren't rounded.
I want all this corners to be round.
Easy . use border-radius on table.
table{
border:1px solid black;
border-radius:10px;
}
<!DOCTYPE html>
<html>
<body>
<h2>Filterable Table</h2>
<br><br>
<table>
<thead>
<tr>
<th>Firstname</th>
<th>Lastname</th>
<th>Email</th>
</tr>
</thead>
<tbody id="myTable">
<tr>
<td>John</td>
<td>Doe</td>
<td>john#example.com</td>
</tr>
<tr>
<td>Mary</td>
<td>Moe</td>
<td>mary#mail.com</td>
</tr>
<tr>
<td>July</td>
<td>Dooley</td>
<td>july#greatstuff.com</td>
</tr>
<tr>
<td>Anja</td>
<td>Ravendale</td>
<td>a_r#test.com</td>
</tr>
</tbody>
</table>
</body>
</html>
Try this, it's should also make it a bit nicer to look at. u can always change the colors yourself.
body {
margin: 30px;
}
table {
border-collapse: separate;
border-spacing: 0;
min-width: 350px;
}
table tr th,
table tr td {
border-right: 1px solid #bbb;
border-bottom: 1px solid #bbb;
padding: 5px;
}
table tr th:first-child,
table tr td:first-child {
border-left: 1px solid #bbb;
}
table tr th {
background: #eee;
border-top: 1px solid #bbb;
text-align: left;
}
/* top-left border-radius */
table tr:first-child th:first-child {
border-top-left-radius: 5px;
}
/* top-right border-radius */
table tr:first-child th:last-child {
border-top-right-radius: 5px;
}
/* bottom-left border-radius */
table tr:last-child td:first-child {
border-bottom-left-radius: 5px;
}
/* bottom-right border-radius */
table tr:last-child td:last-child {
border-bottom-right-radius: 5px;
}
Solution for the table that you have mentioned
<style>
body {
margin: 30px;
}
table {
border-collapse: separate;
border-spacing: 0;
min-width: 350px;
}
table tr th,
table tr td {
border-right: 1px solid #bbb;
border-bottom: 1px solid #bbb;
padding: 5px;
}
table tr th:first-child,
table tr td:first-child {
border-left: 1px solid #bbb;
}
table tr th {
background: #eee;
border-top: 1px solid #bbb;
text-align: left;
}
/* top-left border-radius */
table tr:first-child th:first-child {
border-top-left-radius: 6px;
}
/* top-right border-radius */
table tr:first-child th:last-child {
border-top-right-radius: 6px;
}
/* bottom-left border-radius */
table tr:last-child td:first-child {
border-bottom-left-radius: 6px;
}
/* bottom-right border-radius */
table tr:last-child td:last-child {
border-bottom-right-radius: 6px;
}
</style>
<table>
<tr>
<th colspan="2">header</th>
</tr>
<tr>
<td>data1</td>
<td>data2</td>
</tr>
</table>
This question already has answers here:
The border-radius property and border-collapse:collapse don't mix. How can I use border-radius to create a collapsed table with rounded corners?
(27 answers)
Closed 7 years ago.
table {
width:100%;
}
table, td, tr {
border: 1px #000000 solid;
border-collapse: collapse;
border-radius: 10px;
}
tr {
height:50px;
}
.price {
width: 65%;
text-align: center;
background-color: #000000;
color: #ffffff;
font-size: 1.5em;
border-color: #c0c0c0;
border-radius: 10px;
}
.buy {
width:35%;
text-align: center;
background-color: red;
color: #ffffff;
border-color: #c0c0c0;
}
<table>
<tr>
<td class="price">$180</td>
<td class="buy">Buy</td>
</tr>
<tr>
<td class="price">$180</td>
<td class="buy">Buy</td>
</tr>
<tr>
<td class="price">$180</td>
<td class="buy">Buy</td>
</tr>
</table>
I try to set border-radius to my "td" but not working.
What I want it looks like is border of td of both right and left side is radius.
Is any way can do that?
Here is a jsfiddle for you:
table {
width:100%;
background: #000;
border: #000 1px solid;
-moz-border-radius: 10px;
-webkit-border-radius: 10px;
border-radius: 10px;
}
td, tr {
border: 1px #000000 solid;
border-collapse: collapse;
border-radius: 10px;
}
I'm trying to make a table with border-radius. Since I have different settings in the first and last row of the table (tr:first and last-child), I've created them separately in CSS file. Every setting is right like I want except for border-radius.
The code goes like this:
.tables
{
letter-spacing: 0.10em;
border-collapse: collapse;
width: 100%;
color: #919499;
background-color: #2f333b;
table-layout: fixed;
font-size: 14px;
}
.tables tr:first-child
{
letter-spacing: 0.15em;
border-collapse: collapse;
font-size: 18px;
background-color: #e97770;
border-top-left-radius: 0.5em !important;
border-top-right-radius: 0.5em !important;
-webkit-border-top-right-radius: 0.5em !important;
-webkit-border-top-left-radius: 0.5em !important;
-moz-border-top-right-radius: 0.5em !important;
-moz-border-top-left-radius: 0.5em !important;
width: 100%;
table-layout: fixed;
}
.tables tr:last-child
{
border-bottom-left-radius: 0.5em;
border-bottom-right-radius: 0.5em;
-webkit-border-bottom-right-radius: 0.5em !important;
-webkit-border-bottom-left-radius: 0.5em !important;
-moz-border-bottom-right-radius: 0.5em !important;
-moz-border-bottom-left-radius: 0.5em !important;
}
Any ideas how to achieve this?
You can't style the TR element it needs to be on the TD. So you would need to use something like this:
.tables tr:first-child td:first-child{
/* top left radius styles here */
}
.tables tr:first-child td:last-child{
/* top right radius styles here */
}
.tables tr:last-child td:first-child{
/* bottom left radius styles here */
}
.tables tr:last-child td:last-child{
/* bottom right radius styles here */
}
Hope it helps.
I have a table that gets loaded from a text file. The table is contained within a container div. I've styled the table, but when the table has too many columns for the width of the container div, the content overflows and is now scroll-able. This is not a problem, however, from the point where the overflow occurs, the styling for the table does not apply anymore.
Please have a look at the image:
The styling for this table is below:
table.static {
width: 100%;
margin-bottom: 0!important;
margin-top: 0!important;
}
table.static thead {
background: #D0D6DA;
border-bottom: 1px solid #aaa;
}
table.static thead tr th {
border-left: none;
border-right: none;
line-height: 30px;
padding: 0 10px;
text-align: left;
color: #333;
font-weight: 400;
text-shadow: 0 1px 0 #fff;
}
table.static tbody tr td {
line-height: 25px;
padding: 0 10px;
border: 0 solid #999;
}
table.static tbody tr td {
border-bottom: 1px solid #E1E5E7;
}
table.static tbody tr:last-child td {
border-bottom: 0;
}
table.static tbody tr.even td {
background-color: #EDF1F3;
border-bottom: 1px solid #D8DCDE;
}
table.static tbody tr td input,
table.static tbody tr td button {
margin: 10px 0;
}
Can anyone please explain why this is happening, and what I can do to fix it? Thank you
Try this
table.static {
min-width: 100%;
margin-bottom: 0!important;
margin-top: 0!important;
}