Progress bar in a cell of a table

Asked

Viewed 122 times

2

I am making a calendar and need to make a progress bar of the time elapsed each day. I have assembled the calendar using HTML tables.

How can I make this progress bar each day separately?

  • You’re using Bootstrap by chance?

  • I am, but the question is that I want to put a progress bar for each day. Is it possible to do this? Remembering that every day is a cell of a table

  • Phelipe edited my answer completely as BS etc, I think it got closer than you wanted, read there that has more details.

1 answer

1


I edited the answer completely, now that you said that is Bootstrap I made this template with a bar for each day, with the original BS classes, does not include any new CSS and I think will suit you. What you need to customize just do a Class Override.

See the Snippet below:

<!DOCTYPE html>
<html lang="en">
<head>
  <title>Bootstrap Example</title>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
  <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
  <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>

</head>
<body>

<div class="container">
  <h2>Tabela com Borda</h2>
  <p>A classe .table-bordered coloca a borda na Table</p>            
  <table class="table table-bordered">
    <thead>
      <tr>
        <th colspan="7">
            <h3 class="text-center">MÊS</h3>
        </th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td class="active">
          <h4 class="text-center">1</h4>
          <div class="progress">
            <div class="progress-bar progress-bar-success" role="progressbar" aria-valuenow="100"
            aria-valuemin="0" aria-valuemax="100" style="width:100%">
              100% Complete (success)
            </div>
          </div>
        </td>
        <td>
          <h4 class="text-center">2</h4>
          <div class="progress">
            <div class="progress-bar progress-bar-success" role="progressbar" aria-valuenow="100"
            aria-valuemin="0" aria-valuemax="100" style="width:100%">
              100% Complete (success)
            </div>
          </div>
        </td>
        <td>
          <h4 class="text-center">3</h4>
          <div class="progress">
            <div class="progress-bar progress-bar-success" role="progressbar" aria-valuenow="100"
            aria-valuemin="0" aria-valuemax="100" style="width:100%">
              100% Complete (success)
            </div>
          </div>
        </td>
        <td>
          <h4 class="text-center">4</h4>
          <div class="progress">
            <div class="progress-bar progress-bar-success" role="progressbar" aria-valuenow="100"
            aria-valuemin="0" aria-valuemax="100" style="width:100%">
              100% Complete (success)
            </div>
          </div>
        </td>
        <td>
          <h4 class="text-center">5</h4>
          <div class="progress">
            <div class="progress-bar progress-bar-success" role="progressbar" aria-valuenow="100"
            aria-valuemin="0" aria-valuemax="100" style="width:100%">
              100% Complete (success)
            </div>
          </div>
        </td>
        <td>
          <h4 class="text-center">6</h4>
          <div class="progress">
            <div class="progress-bar progress-bar-success" role="progressbar" aria-valuenow="100"
            aria-valuemin="0" aria-valuemax="100" style="width:100%">
              100% Complete (success)
            </div>
          </div>
        </td>
        <td>
          <h4 class="text-center">7</h4>
          <div class="progress">
            <div class="progress-bar progress-bar-warning" role="progressbar" aria-valuenow="60"
            aria-valuemin="0" aria-valuemax="100" style="width:60%">
              60% Complete (warning)
            </div>
          </div>
        </td>
      </tr>
      <tr>
        <td class="active">
          <h4 class="text-center">8</h4>
          <div class="progress">
            <div class="progress-bar progress-bar-success" role="progressbar" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100" style="width:0%">
            </div>
          </div>
        </td>
        <td>
          <h4 class="text-center">9</h4>
          <div class="progress">
            <div class="progress-bar progress-bar-success" role="progressbar" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100" style="width:0%">
            </div>
          </div>
        </td>
        <td>
          <h4 class="text-center">10</h4>
          <div class="progress">
            <div class="progress-bar progress-bar-success" role="progressbar" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100" style="width:0%">
            </div>
          </div>
        </td>
        <td>
          <h4 class="text-center">11</h4>
          <div class="progress">
            <div class="progress-bar progress-bar-success" role="progressbar" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100" style="width:0%">
            </div>
          </div>
        </td>
        <td>
          <h4 class="text-center">12</h4>
          <div class="progress">
            <div class="progress-bar progress-bar-success" role="progressbar" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100" style="width:0%">
            </div>
          </div>
        </td>
        <td>
          <h4 class="text-center">13</h4>
          <div class="progress">
            <div class="progress-bar progress-bar-success" role="progressbar" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100" style="width:0%">
            </div>
          </div>
        </td>
        <td>
          <h4 class="text-center">14</h4>
          <div class="progress">
            <div class="progress-bar progress-bar-success" role="progressbar" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100" style="width:0%">
            </div>
          </div>
        </td>
      </tr>
      <tr>
        <td class="active">
          <h4 class="text-center">15</h4>
          <div class="progress">
            <div class="progress-bar progress-bar-success" role="progressbar" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100" style="width:0%">
            </div>
          </div>
        </td>
        <td>
          <h4 class="text-center">16</h4>
          <div class="progress">
            <div class="progress-bar progress-bar-success" role="progressbar" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100" style="width:0%">
            </div>
          </div>
        </td>
        <td>
          <h4 class="text-center">17</h4>
          <div class="progress">
            <div class="progress-bar progress-bar-success" role="progressbar" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100" style="width:0%">
            </div>
          </div>
        </td>
        <td>
          <h4 class="text-center">18</h4>
          <div class="progress">
            <div class="progress-bar progress-bar-success" role="progressbar" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100" style="width:0%">
            </div>
          </div>
        </td>
        <td>
          <h4 class="text-center">19</h4>
          <div class="progress">
            <div class="progress-bar progress-bar-success" role="progressbar" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100" style="width:0%">
            </div>
          </div>
        </td>
        <td>
          <h4 class="text-center">20</h4>
          <div class="progress">
            <div class="progress-bar progress-bar-success" role="progressbar" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100" style="width:0%">
            </div>
          </div>
        </td>
        <td>
          <h4 class="text-center">21</h4>
        <div class="progress">
            <div class="progress-bar progress-bar-success" role="progressbar" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100" style="width:0%">
            </div>
          </div>
        </td>
      </tr>
      <tr>
        <td class="active">22</td>
        <td>23</td>
        <td>24</td>
        <td>25</td>
        <td>26</td>
        <td>27</td>
        <td>28</td>
      </tr>
      <tr>
        <td class="active">29</td>
        <td>30</td>
        <td>31</td>
        <td></td>
        <td></td>
        <td></td>
        <td></td>
      </tr>
    </tbody>
  </table>
</div>

</body>
</html>

I left the rest of the month for you to finish up and see how it was done!

In the <div class="progress-bar progress-bar-warning" role="progressbar" aria-valuenow="60"aria-valuemin="0" aria-valuemax="100" style="width:60%"> you can work with the values dynamically to make the bar go round throughout the day.

Text inside the slider is optional You may or may not have "100% Complete (Success)"

Browser other questions tagged

You are not signed in. Login or sign up in order to post.