Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums CSS CSS Clutter – What is the best way to optimize? Reply To: CSS Clutter – What is the best way to optimize?

#256154
rkieru
Participant

You could create a custom build of Bootstrap from their website, specifying that there should be 0px padding on all margins. That would provide you a solution that removes a lot of redundant CSS.

You could also just eliminate all the bajillion .col declarations with a wildcard:

[class*='col-'] {
  position: relative;
  min-height: 1px;
  padding-right: 0;
  padding-left: 0;
}

A more robust approach might be to combine the wildcard AND your .no-padding idea, but apply the latter to the .container.

.no-padding [class*='col-'] {
  position: relative;
  min-height: 1px;
  padding-right: 0;
  padding-left: 0;
}

That let’s you have padded grid layouts where appropriate, and those without where desired.