Complex HTML table with bootstrap

Asked

Viewed 567 times

1

How to make more complex tables in html and use bootstrap? I searched the web, but I couldn’t understand it very well. how can I create this table in HTML, and use bootstrap. inserir a descrição da imagem aqui

Someone would have to give me at least one north, so that I can create this table in HTML, and use the bootstrap stylings

  • You won’t find a better place than the official documentation: https://getbootstrap.com.br/docs/4.1/content/tables/

  • my biggest problem, it’s not even with styling, my problem, bigger is how to create this table in html! , I’ve never made a table like this.

1 answer

2


Right here in the documentation has described this https://getbootstrap.com/docs/4.3/contenttables/#bordered-table actually you have to use colspan or rowspan depending on how you want to expand the table cells, and this has nothing to do with Bootstrap itself...

inserir a descrição da imagem aqui

Here is an example

<!DOCTYPE html>
<html lang="en">

<head>
<meta charset="utf-8" />
<title>Page Title</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" type="text/css" media="screen" href="https://stackpath.bootstrapcdn.com/bootstrap/4.2.1/css/bootstrap.min.css" />
<link rel="stylesheet" type="text/css" media="screen" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.8.2/css/all.min.css" />

</head>

<body>

   
        <div class="table-responsive">
            <table class="table table-bordered">
                <thead>
                    <tr>
                        <th scope="col">#</th>
                        <th scope="col">Heading</th>
                        <th scope="col" colspan="3" class="text-center">Heading</th>
                        <th scope="col">Heading</th>
                        <th scope="col">Heading</th>
                        <th scope="col">Heading</th>
                        <th scope="col">Heading</th>
                        <th scope="col">Heading</th>
                    </tr>
                </thead>
                <tbody>
                    <tr>
                        <th scope="row">1</th>
                        <td>Cell</td>
                        <td>Cell</td>
                        <td>Cell</td>
                        <td>Cell</td>
                        <td>Cell</td>
                        <td>Cell</td>
                        <td>Cell</td>
                        <td>Cell</td>
                        <td>Cell</td>
                    </tr>
                    <tr>
                        <th scope="row">2</th>
                        <td>Cell</td>
                        <td>Cell</td>
                        <td>Cell</td>
                        <td>Cell</td>
                        <td>Cell</td>
                        <td>Cell</td>
                        <td>Cell</td>
                        <td>Cell</td>
                        <td>Cell</td>
                    </tr>
                    <tr>
                        <th scope="row">3</th>
                        <td>Cell</td>
                        <td>Cell</td>
                        <td>Cell</td>
                        <td>Cell</td>
                        <td>Cell</td>
                        <td>Cell</td>
                        <td>Cell</td>
                        <td>Cell</td>
                        <td>Cell</td>
                    </tr>
                </tbody>
            </table>
        </div>
    

    <script src="https://code.jquery.com/jquery-3.2.1.min.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js"></script>
    <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.2.1/js/bootstrap.min.js"></script>
</body>

</html>

  • Yeah, my biggest problem is in structuring html, to build this table

  • 1

    @Rafaelpassos ta ai example, vc can start yours from it. And study on colspan and rowspan. This will help you https://answall.com/questions/400703/rowspan-replace%C3%Adda-by-other-attribute/400715#400715

Browser other questions tagged

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