Mark Sweet Mark Sweet - 7 months ago 11
HTML Question

Table borders not appearing

I'm having trouble adding a

border
to my
table
.

Here is my code.



table, th {
margin-top: 15px;
border: 100px, black, solid;
}

<div class="containeer">
<table class="col-md-12">
<th>Name</th>
<th>TItle</th>
<th>Description</th>
</table>
</div>





I don't care what kind of
border
right now. Just trying to get the
border
working.

Answer

2 things:

  • margin won't work in table and th, use padding instead (or you can use border-spacing + border-collapse to have space inside the table )
  • your border syntax is wrong, see here about border

Side Note:

Guessing you are using Twitter Bootstrap, based on your .col-md-12 you have a typo on your class .containeer, should be .container and should have a child .row see Docs

table,
th {
  padding-top: 15px;
  border: 100px black solid;
}
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet" />
<div class="container">
  <div class="row">
    <table class="col-md-12">
      <th>Name</th>
      <th>TItle</th>
      <th>Description</th>
    </table>
  </div>
</div>