0

I have a table with rounded corners. The basic CSS for this is that I added the class .table-bordered on the table-element like this:

 .table-bordered 
   {
     border: 1px solid @tableBorder;
     border-collapse: separate; 
    .border-radius(@baseBorderRadius);
  }

this works great. But we have implemented a drag-function in javascript. It is possible to drag elements into the table rows.

To show the user what row they are dragging an element to, I want to add a dashed border to the TR like this:

tr.dropzone-active {
    border: 3px dashed darken(@portletBorderColor, 10%);
    .box-shadow(0 0 10px 0 rgba(0, 0, 0, .25));
    .scale(1.01);
}

So when I drag a document over the TR, i add the class dropzone-active to the TR to change the border. Box-shadow and .scale works with this. But the border is not changed (to 3px and dashed). The reason for this, is the table-css element:

border-collapse: separate;

If I remove this, the drag-drop border changes, but then my corners are not rounded. Is there someway to fix this?

for example to add border-collapse: collapse to the dropzone-active element or something?

TylerH
  • 20,799
  • 66
  • 75
  • 101
TorK
  • 567
  • 2
  • 10
  • 27

1 Answers1

0

Were you aiming for this effect?

.table {
  display:block;
  width: 100px;
  padding:20px;
  margin-top: 10px;
  margin-left:10px;
  margin-right:10px;
  border-collapse: separate;
  border-spacing: 0;
  border: 1px solid black;
  border-radius: 6px;
  -moz-border-radius:6px;
  -webkit-border-radius:6px;
  border-style: hidden; /* hide standard table (collapsed) border */
  box-shadow: 0 0 0 1px #666; /* this draws the table border  */ 
}
tr.dropzone-active {
  border-style: dotted;
}
table tr th,
table tr td {
  border-right: 1px dotted #bbb;
  border-bottom: 1px dotted #bbb;
  border-left: 1px dotted #bbb;
  padding: 5px;
}
/* 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;
}
table tr th:first-child,
table tr td:first-child {
  border-left: 1px solid #bbb;
}
<table class="table">
<thead>
  <tr class="dropzone-active">
    <th>1</th>
    <th>2</th>
  </tr>
</thead>
<tbody>
  <tr>
    <td>fname</td>
    <td>lname</td>
  </tr>
  
</tbody>
</table>
odedta
  • 2,430
  • 4
  • 24
  • 51