0

Is there a way to remove padding from column of all sizes in Bootstrap 4? I can alter just one class by doing col {padding: 0;} but that will only effect the col class. Not it's other counterparts(col-2, col-3 etc). Is there a way in css to select a range of classes? Like col-* would select all classes that start with col-. It would be helpful if there is a solution might be applicable in this situation.

KMA Badshah
  • 895
  • 8
  • 16
  • 2
    Is this what you're looking for https://getbootstrap.com/docs/4.0/layout/grid/#no-gutters? – Thamindu DJ Jul 29 '20 at 17:19
  • Does this answer your question? [Remove gutter space for a specific div only](https://stackoverflow.com/questions/16489307/remove-gutter-space-for-a-specific-div-only/21282059#21282059) – FluffyKitten Jul 29 '20 at 17:24
  • @ThaminduDJ It seems to work. But I do have one question. If I place the no gutters class into one row, will it affect any column nested within another row inside the previous row? Or will I have to place no gutters every time I use the row class, regardless of nesting? – KMA Badshah Jul 29 '20 at 17:29
  • 2
    @KMA Badshah I think you have to use every time, you use the row of nesting. – Janitha Rasanga Jul 29 '20 at 17:37
  • 3
    I'm not sure about that. You can try and find out. But according to the code segment given at the site, it will only be applied to all immediate children columns of the row – Thamindu DJ Jul 29 '20 at 17:37
  • @Thamindu DJ You are correct bro. – Janitha Rasanga Jul 29 '20 at 17:38
  • I've tested it and @ThaminduDJ is right. The no-gutters class only applies to immediate col classes. You'll have to use no-gutters regardless of nesting in order to achieve desired affects. – KMA Badshah Jul 29 '20 at 17:41

0 Answers0