Bootstrap table without stripe / borders

后端 未结 16 869
天命终不由人
天命终不由人 2020-12-12 11:54

I\'m kinda stuck with a CSS problem while using Bootstrap. I\'m also using Angular JS with Angular UI.bootstrap (which might be part of the problem).

I\'m making a w

相关标签:
16条回答
  • 2020-12-12 12:10

    Most examples seem to be too specific and/or bloated.

    Here was my trimmed down solution using Bootstrap 4.0.0 (4.1 includes .table-borderless but still alpha)...

    .table-borderless th{border:0;}
    .table-borderless td{border:0;}
    

    Similar to many proposed solutions, but minimal bytes

    0 讨论(0)
  • 2020-12-12 12:13

    Try this:

    <table class='borderless'>
    

    CSS

    .borderless {
     border:none;
    }
    

    Note: What you were doing before was not working because your css code was targeting a table within your .borderless table (which probably didn't exist)

    0 讨论(0)
  • 2020-12-12 12:13

    Use the border- class from Boostrap 4

    <td class="border-0"></td>
    

    or

    <table class='table border-0'></table>
    

    Be sure to end the class input with the last change you want to do.

    0 讨论(0)
  • 2020-12-12 12:15

    In some cases, one must also use border-spacing in the table class, like:

    border-spacing: 0 !important;

    0 讨论(0)
  • 2020-12-12 12:17

    I know this is an old thread and that you've picked an answer, but I thought I'd post this as it is relevant for anyone else that is currently looking.

    There is no reason to create new CSS rules, simply undo the current rules and the borders will disappear.

    
        .table>tbody>tr>th,
        .table>tbody>tr>td {
            border-top: 0;
        }
    
    

    going forward, anything styled with

        .table
    

    will show no borders.

    0 讨论(0)
  • 2020-12-12 12:18

    I expanded the Bootstrap table styles as Davide Pastore did, but with that method the styles are applied to all child tables as well, and they don't apply to the footer.

    A better solution would be imitating the core Bootstrap table styles, but with your new class:

    .table-borderless>thead>tr>th
    .table-borderless>thead>tr>td
    .table-borderless>tbody>tr>th
    .table-borderless>tbody>tr>td
    .table-borderless>tfoot>tr>th
    .table-borderless>tfoot>tr>td {
        border: none;
    }
    

    Then when you use <table class='table table-borderless'> only the specific table with the class will be bordered, not any table in the tree.

    0 讨论(0)
提交回复
热议问题