3

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;
}
Mohammad Dayyan
  • 21,578
  • 41
  • 164
  • 232

2 Answers2

5

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;
}
James Donnelly
  • 126,410
  • 34
  • 208
  • 218
1

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

user229044
  • 232,980
  • 40
  • 330
  • 338
Sajad Karuthedath
  • 14,987
  • 4
  • 32
  • 49