简体   繁体   中英

How to override bootstrap table td style?

I'm using Bootstrap 3.3
I have a HTML code as follows:

<div data-name="md-PersianDateTimePicker">
    <table class="table table-striped">        
        <tr>
            <td data-name="day">03</td>
            <td data-name="day">04</td>
            <td data-name="day">05</td>
            <td data-name="day">06</td>
            <td data-name="day">07</td>
            <td data-name="day">09</td>
            <td data-name="day" class="text-danger">09</td>
        </tr>
        .
        .
        .
    </table>
</div>

How can I set padding:2px to each td ?

I tested the following, it doesn't work!

[data-name="md-PersianDateTimePicker"] td{ 
   padding: 2px;
}

Simply increase the specificity of your selector. If what you have currently doesn't work, try adding the table into it as well:

[data-name="md-PersianDateTimePicker"] table.table.table-striped td[data-name="day"] {
    padding: 2px;
}

add !important specifier

[data-name="md-PersianDateTimePicker"] td{ 
   padding: 2px !important;
}

DEMO FIDDLE

NOTE :

Never use !important on site-wide css. Only use !important on page-specific css that overrides site-wide or foreign css

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM