Paint top title bar of a table with bootstrap

3

How do I paint the top title bar of a table made with bootstrap?

To paint any thead TR.

<div class="pull-right" id="tabela4">
  <br />
  <table class="table table-striped table-ordered table-bordered col-md-4">
    <thead>
      <tr>
        <td><strong>ID</strong></td>
        <td><strong>Tipo</strong></td>
        <td><strong>Descrição</strong></td>
        <td><strong>Usuário</strong></td>
        <td><strong>Data de Inclusão</strong></td>
        <td><strong>Status</strong></td>
        <td></td>
      </tr>
    </thead>

    <tbody>
      <tr>
        <td class="col-xs-2 col-sm-2 col-md-2 col-lg-2"><small>' + this.ID_CRM_Evento + '</small></td>
        <td class="col-xs-2 col-sm-2 col-md-2 col-lg-2"><small>' + this.ID_TipoEvento  + '</small></td>
        <td class="col-xs-2 col-sm-2 col-md-2 col-lg-2"><small>' + this.DE_Descricao  + '</small></td>
        <td class="col-xs-4 col-sm-4 col-md-4 col-lg-4"><small>' + this.DE_Usuario + '</small></td>
        <td class="col-xs-4 col-sm-4 col-md-4 col-lg-4"><small>' + getFormattedDate(this.DT_Inclusao) + '</small></td>
        <td class="col-xs-4 col-sm-4 col-md-4 col-lg-4"><small>' + this.DE_Status + '</small></td>
        <td class="col-xs-2 col-sm-2 col-md-2 col-lg-2"><button type="button" class="btn btn-primary">Visualizar</button></td>
      </tr>
    </tbody>
  </table>
</div>
    
asked by anonymous 27.06.2014 / 22:20

2 answers

2

You can do it in your CSS

table thead tr td {background-color:red;}

Fiddle

    
27.06.2014 / 22:38
1

Would that be?

HTML:

<div class="pull-right" id="tabela4">
            <br />
            <table class="table table-striped table-ordered table-bordered col-md-4">
            <thead >
            <tr class="paint">
            <td><strong>ID</strong></td>
            <td><strong>Tipo</strong></td>
            <td><strong>Descrição</strong></td>
            <td><strong>Usuário</strong></td>
            <td><strong>Data de Inclusão</strong></td>
            <td><strong>Status</strong></td>
            <td></td>
            </tr>
            </thead>

            <tbody>
                <tr>
                    <td class="col-xs-2 col-sm-2 col-md-2 col-lg-2"><small>' + this.ID_CRM_Evento + '</small></td>
                    <td class="col-xs-2 col-sm-2 col-md-2 col-lg-2"><small>' + this.ID_TipoEvento  + '</small></td>
                    <td class="col-xs-2 col-sm-2 col-md-2 col-lg-2"><small>' + this.DE_Descricao  + '</small></td>
                    <td class="col-xs-4 col-sm-4 col-md-4 col-lg-4"><small>' + this.DE_Usuario + '</small></td>
                    <td class="col-xs-4 col-sm-4 col-md-4 col-lg-4"><small>' + getFormattedDate(this.DT_Inclusao) + '</small></td>
                    <td class="col-xs-4 col-sm-4 col-md-4 col-lg-4"><small>' + this.DE_Status + '</small></td>
                    <td class="col-xs-2 col-sm-2 col-md-2 col-lg-2"><button type="button" class="btn btn-primary">Visualizar</button></td>
                </tr>
            </tbody>
            </table>
            </div>

CSS:

.paint{
    background-color: green;
}

Example : link

Let's say you also want to remove the rows (borders) of the columns, you can use them in css:

thead > tr > td{
    border: none !important;
        border-collapse:collapse;
}
    
27.06.2014 / 22:37