Reputation:
I am using custom css with bootstrap for outer border. but the top border isnt visible unless i make its size to 2 px.
how can i solve this?
HTML
<table class="table table-condensed table-hover border">
<tr><td>#</td><td><strong>name</strong></td></tr>
<tr><td>1.</td><td>one</td></tr>
<tr><td>2.</td><td>two</td></tr>
<tr><td>3.</td><td>three</td></tr>
<tr><td>4.</td><td>four</td></tr>
</table>
CSS
@import url("http://netdna.bootstrapcdn.com/bootswatch/3.0.3/cerulean/bootstrap.min.css");
@import url("http://netdna.bootstrapcdn.com/bootstrap/3.0.3/css/bootstrap-theme.min.css");
.border{
background-color:#fff;
color:#000;
padding:10px;
border:1px solid #4C7ED1;
}
I would like a Outer Table Border of 1px #4C7ED1 Its visible on all sides except top , how can i fix it ?
Thanks
Upvotes: 1
Views: 15585
Reputation: 325
In bootstrap 4, the class table-condensed
is renamed to table-sm
for consistency.
Upvotes: 6
Reputation: 1981
you should change your first table inside tags to thead
like this:
<table class="table table-condensed table-hover border">
<thead><td>#</td><td><strong>name</strong></td></thead>
<tr><td>1.</td><td>one</td></tr>
<tr><td>2.</td><td>two</td></tr>
<tr><td>3.</td><td>three</td></tr>
<tr><td>4.</td><td>four</td></tr>
</table>
then you'll have top border of table and you now you can modify css rule for this element
Upvotes: 2
Reputation: 1489
Use border:1px double #4C7ED1;
instead of border:1px solid #4C7ED1;
Here is a DEMO
Upvotes: 2
Reputation: 1811
Delving into the DOM, you'll notice that it's the <td>
that have a border-top property of 1px solid #ddd
. All you needed to do was select the <td>
s within the first <tr>
and then apply the border you wanted.
Ultimately, it meant adding this to your CSS:
.border tr:first-child td {
border-top: 1px solid #4C7ED1;
}
Upvotes: 2