Table's border-radius does not function as expected - html

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 */
}

Related

Why background-color overlap the box-shadow?

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>

How do I apply a border radius to Bootstrap 3's tables?

I want the top corners and bottom corners of a table to have rounded corners.
How can I do this? Right now, the Bootstrap 3 tables have 0 radius.
Try this :-
<table class="table table-curved">
....
</table>
.table-curved {
border-collapse: separate;
}
.table-curved {
border: solid #ccc 1px;
border-radius: 6px;
border-left:0px;
}
.table-curved td, .table-curved th {
border-left: 1px solid #ccc;
border-top: 1px solid #ccc;
}
.table-curved th {
border-top: none;
}
.table-curved th:first-child {
border-radius: 6px 0 0 0;
}
.table-curved th:last-child {
border-radius: 0 6px 0 0;
}
.table-curved th:only-child{
border-radius: 6px 6px 0 0;
}
.table-curved tr:last-child td:first-child {
border-radius: 0 0 0 6px;
}
.table-curved tr:last-child td:last-child {
border-radius: 0 0 6px 0;
}
The easiest way is wrap the table with a panel. Then your table will have rounded corners automatically.
Example:
<div class="panel panel-default">
<table class="table table-striped">
....
</table>
</div>
Note: panel-default will add a 1px grey border. if you want to hide it just add border-color:white; to style of panel-default.

HTML Table THEAD Element Background color not rounding

I have the following HTML & CSS
HTML
<table class="StandardTable">
<thead>
<tr>
<th>A</th>
<th>B</th>
<th>C</th>
<th>D</th>
</tr>
</thead>
<tbody>
<tr>
<td style="width: 25%">A</td>
<td style="width: 25%">B</td>
<td style="width: 25%">C</td>
<td style="width: 25%">D</td>
</tr>
</tbody>
</table>
CSS
.StandardTable {
border: 1px solid #656565;
border-radius: 10px;
-moz-border-radius: 10px;
margin-left: auto;
margin-right: auto;
box-shadow: 10px 10px 5px #888888;
width: 300px;
margin-bottom: 15px;
border-spacing: 0;
}
.StandardTable thead {
border-radius: 10px;
-moz-border-radius: 10px;
border-radius: 5px;
background-color: lightgray;
}
I have created the jsFiddle for this too. The background in the THEAD always bleeds / runs out of the border and does not round.
I tested in IE, FF, and chrome. It is most apparent in chrome because the bleed happens above the border where in IE and FF the bleed happens under.
Any help in fixing the issue (make the background stop correctly around the edges), is greatly appreciated. I did try to add Border-Radius on TH element, but that did not work.
You need to apply the rounded corners to the first and last table cell in the thead. Set the background for thead to transparent, and add this:
.StandardTable thead th{
background: lightgray;
}
.StandardTable thead th:first-of-type{
border-top-left-radius: 10px;
}
.StandardTable thead th:last-of-type{
border-top-right-radius: 10px;
}
Demo JsFiddle
try this (worked for me in FF)
.StandardTable {
border: 1px solid #656565;
border-radius: 10px;
-moz-border-radius: 10px;
margin-left: auto;
margin-right: auto;
box-shadow: 10px 10px 5px #888888;
width: 300px;
margin-bottom: 15px;
border-spacing: 0;
}
.StandardTable thead tr th {
background-color: lightgray;
}
.StandardTable thead tr th:first-child {
z-index:-1;
border-radius: 10px 0 0 0;
-moz-border-radius: 10px 0 0 0;
border-radius: 10px 0 0 0;
}
.StandardTable thead tr th:last-child {
z-index:-1;
border-radius: 0 10px 0 0;
-moz-border-radius: 0 10px 0 0;
border-radius: 0 10px 0 0;
}
Another workaround is to do the following
.StandardTable {
border: 1px solid #656565;
border-radius: 10px;
-moz-border-radius: 10px;
margin-left: auto;
margin-right: auto;
box-shadow: 10px 10px 5px #888888;
width: 300px;
margin-bottom: 15px;
border-spacing: 0;
background-color: lightgray;
}
.StandardTable tbody tr td {
background-color: white;
}
.StandardTable tbody tr:last-child td:last-child {
border-bottom-right-radius: 10px;
}
.StandardTable tbody tr:last-child td:first-child {
border-bottom-left-radius: 10px;
}

Jquery Mobile tables with rounded edges

I'm busy using reflow tables in jquery mobile. I would like to have the 1st and last rows of my table to have rounded edges. I'm using the following code:
th:first-child {
-moz-border-radius: 6px 0 0 0;
-webkit-border-radius: 6px 0 0 0;
border-radius: 6px 0 0 0;
}
th:last-child {
-moz-border-radius: 0 6px 0 0;
-webkit-border-radius: 0 6px 0 0;
border-radius: 0 6px 0 0;
}
The HTML is similar to this;
<table>
<thead>
<tr>
<th>First column</th>
<th>Second column</th>
</tr>
</thead>
<tbody>
<tr>
<td>Row one, cell one</td>
<td>Row one, cell two</td>
</tr>
<tr>
<td>Row two, cell one</td>
<td>Row two, cell two</td>
</tr>
<tr>
<td>Row three, cell one</td>
<td>Row four, cell two</td>
</tr>
</tbody>
I would literally just want the top most and bottom most cell to have rounded edges.
This comes a little close...
thead tr:first-child th:first-child {
-moz-border-radius: 6px 0 0 0;
-webkit-border-radius: 6px 0 0 0;
border-radius: 6px 0 0 0;
}
thead tr:first-child th:last-child {
-moz-border-radius: 0px 6px 0 0;
-webkit-border-radius: 0px 6px 0 0;
border-radius: 0px 6px 0 0;
}
tr:last-child td:first-child{
-moz-border-radius: 0px 0px 0px 6px;
-webkit-border-radius: 0px 0px 0px 6px;
border-radius: 0px 0px 0px 6px;
}
tr:last-child td:last-child{
-moz-border-radius: 0px 0px 6px 0px;
-webkit-border-radius: 0px 0px 6px 0px;
border-radius: 0px 0px 6px 0px;
}
Your problem is related to the element's display property, this should solve it.
It works by giving the table itself the border properties:
table {
border: 1px solid #000;
-moz-border-radius: 6px;
-webkit-border-radius: 6px;
border-radius: 6px;
}
DEMO

Box shadow CSS with a <fieldset>. Firefox vs Chrome

I have a problem with CSS on Firefox. A fieldset that renders perfectly on Chrome:
In firefox it shows like this:
I discovered that removing the boxshadow from the CSS the top section, above the fieldset border, disappears on Firefox, but then I don't have the shadow. How can put them both the same?
Here is the code:
<div id="wrapper" style="position: relative;">
<fieldset style="width: 17em;" class="loginField"><legend align="right">Log in</legend>
<table cellspacing="0" cellpadding="0" class="loginVerticalPanel" style="height: auto;">
<tbody>
<tr>
<td align="left" style="vertical-align: top;"><div class="gwt-Label" style="height: auto; width: 100%;">Username:</div></td>
</tr>
<tr>
<td align="left" style="vertical-align: top;"><input type="text" class="gwt-TextBox" style="height: auto; width: 100%;"></td>
</tr>
<tr>
<td align="left" style="vertical-align: top;"><div class="gwt-Label" style="height: auto; width: 100%;">Password:</div></td>
</tr>
<tr>
<td align="left" style="vertical-align: top;"><input type="password" class="gwt-PasswordTextBox" style="height: auto; width: 100%;"></td>
</tr>
<tr>
<td align="left" style="vertical-align: top;">
<table cellspacing="0" cellpadding="0" style="width: 100%;">
<tbody>
<tr>
<td align="left" style="vertical-align: top;">
<img class="gwt-Image" title="Loading" style="display: none;" alt="Loading" src="assets/square_circles.gif">
</td>
<td align="right" style="vertical-align: top;">
<button type="button" class="loginButton" style="height: 25px;">>> GO</button>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr>
<td align="left" style="vertical-align: top;"><div class="loginWarning" style="display: none; width: 100%;"></div></td>
</tr>
</tbody>
</table>
</fieldset>
</div>
And the CSS:
.loginButton {
background: -moz-linear-gradient(90deg, #0459B7, #08ADFF) repeat scroll 0 0 transparent;
background: -webkit-linear-gradient(90deg, #0459B7, #08ADFF) repeat scroll 0 0 transparent;
border: 1px solid #093C75;
border-radius: 3px 3px 3px 3px;
box-shadow: 0 1px 0 #FFFFFF;
color: #FFFFFF;
cursor: pointer;
font-family: Arial,sans-serif;
font-size: 12px;
font-weight: bold;
margin-right: -1em;
margin-top: 1em;
padding: 5px 10px;
text-decoration: none;
text-shadow: 0 1px 1px #333333;
text-transform: uppercase;
}
.loginButton:hover {
background: -moz-linear-gradient(90deg, #067CD3, #0BCDFF) repeat scroll 0 0 transparent;
background: -webkit-linear-gradient(90deg, #067CD3, #0BCDFF) repeat scroll 0 0 transparent;
border-color: #093C75;
text-decoration: none;
}
.loginButton:active {
background: -moz-linear-gradient(90deg, #0BCDFF, #067CD3) repeat scroll 0 0 transparent;
background: -webkit-linear-gradient(90deg, #0BCDFF, #067CD3) repeat scroll 0 0 transparent;
border-color: #093C75;
outline: medium none;;
}
.loginWarning {
padding-top: 0.2em;
font-family: 'Aldrich', sans-serif;
color:#FE2E2E;
font-size: 12px;
font-weight: 400;
}
.loginField {
padding-left: 2em;
padding-right: 2em;
padding-top: 1em;
border: 0;
background: -webkit-linear-gradient(90deg, #CCCCCC, #FFFFFF) repeat scroll 0 0 transparent;
background: -moz-linear-gradient(90deg, #CCCCCC, #FFFFFF) repeat scroll 0 0 transparent;
border: 1px solid #AAAAAA;
border-radius: 10px 10px 10px 10px;
box-shadow: 0 0 15px #AAAAAA;
margin: 60px auto 0;
padding: 20px;
}
.loginField legend {
text-align: right;
background: -webkit-linear-gradient(90deg, #CCCCCC, #FFFFFF) repeat scroll 0 0 transparent;
background: -moz-linear-gradient(90deg, #CCCCCC, #FFFFFF) repeat scroll 0 0 transparent;
border-radius: 10px 10px 10px 10px;
box-shadow: 0 0 15px #AAAAAA;
padding-right: 1em;
padding-left: 1em:
}
.loginField img {
max-width: 24px;
}
.loginVerticalPanel {
margin: 0 auto 0 auto;
}
.loginVerticalPanel input {
background: -webkit-linear-gradient(90deg, #FFFFFF, #EEEEEE) repeat scroll 0 0 transparent;
background: -moz-linear-gradient(90deg, #FFFFFF, #EEEEEE) repeat scroll 0 0 transparent;
border: 1px solid #AAAAAA;
border-radius: 3px 3px 3px 3px;
box-shadow: 0 0 3px #AAAAAA;
padding: 5px;
}
By the way, very nice catch on this! Definitely a future-help-type-of-question.
On the quick run I found a very alternative fix:
.loginField legend {
text-align: right;
background: -webkit-linear-gradient(90deg, #CCCCCC, #FFFFFF) repeat scroll 0 0 transparent;
background: -moz-linear-gradient(90deg, #CCCCCC, #FFFFFF) repeat scroll 0 0 transparent;
border-radius: 10px 10px 10px 10px;
-webkit-box-shadow: 0 0 15px #AAAAAA;
-moz-box-shadow: 0 0 15px #AAAAAA;
box-shadow: 0 0 15px #AAAAAA;
padding-right: 1em;
padding-left: 1em;
position: absolute;
margin: -30px 0px 0px 200px;
}
And the live example: http://jsfiddle.net/xDE4x/1/
I fixed some of your CSS syntax (: instead of ; and etc). Also I added -moz- and -webkit- versions of the CSS3 syntax.
I will keep digging, but this is the first method.. It works great and should be more browser compatible then your CSS3 features.. However, it unsets the legends placement and you need to set it back with negative margins.
What I have done is to set the margin top to a negative value for the legend so that it appears that it has a zero height to the fieldset; I then applied a negative margin in the opposite direction to offset the first negative margin. I then added padding of equal value to the fieldset to get them to position as they normally would.
fieldset
{
padding-top: 14px;
}
fieldset legend
{
margin-top: -14px;
margin-bottom: -14px;
}
Alternatively you can "float" the legend as well, it doesn't require as much work to maintain your layout particularly when you have more than one fieldset. In the questioners case it would be:
.loginField legend {
float: right;
margin-top: -30px;
background: -webkit-linear-gradient(90deg, #CCCCCC, #FFFFFF) repeat scroll 0 0 transparent;
background: -moz-linear-gradient(90deg, #CCCCCC, #FFFFFF) repeat scroll 0 0 transparent;
border-radius: 10px 10px 10px 10px;
box-shadow: 0 0 15px #AAAAAA;
padding-right: 1em;
padding-left: 1em;
}