Отступы
.mb-6 { margin-bottom: 1.5rem; }.mt-15 { margin-top: 15px; }
.mt-20 { margin-top: 20px; }
.mt-30 { margin-top: 30px; }
.mt-40 { margin-top: 40px; }
.mt-50 { margin-top: 50px; }
.pt-40 { padding-top: 40px; }
.pt-50 { padding-top: 50px; }
.pb-20 { padding-bottom: 20px; }
.pb-30 { padding-bottom: 30px; }
.pb-40 { padding-bottom: 40px; }
.pb-50 { padding-bottom: 50px; }
.mb-20 { margin-bottom: 20px; }
.mb-30 { margin-bottom: 30px; }
.mb-40 { margin-bottom: 40px; }
.mb-50 { margin-bottom: 50px; }
.pt-20 { padding-top: 20px; }
.pt-30 { padding-top: 30px; }
Интервалы (Spacing) Bootstrap первоисточник
Горизонтальное центрированиеКроме того, Bootstrap также включает .mx-auto класс для горизонтального центрирования блочного контента фиксированной ширины — то есть контента, имеющего display: blockи width заданный набор параметров — путем установки горизонтальных полей равными auto.
<div class="mx-auto p-2" style="width: 200px;">
Centered element
</div>
Отрицательная marginВ CSS margin свойства могут использовать отрицательные значения ( padding не могут). Эти отрицательные отступы по умолчанию отключены , но их можно включить в Sass, установив соответствующий параметр
$enable-negative-margins: true.
Синтаксис практически идентичен стандартным утилитам для положительных полей, но с добавлением n перед запрашиваемым размером. Вот пример класса, противоположного .mt-1:
.mt-n1 {
margin-top: -0.25rem !important;
}
отступы в bootstrap
Вспомогательные функции для настройки интервалов, применяемые ко всем точкам останова, от xs до xxl, не содержат сокращений точек останова. Это связано с тем, что эти классы применяются начиная с min-width: 0 и выше, и, следовательно, не привязаны к медиа-запросу. Однако для остальных точек останова используется сокращение точки останова.
Классы именуются в формате {property}{sides}-{size} для xs и {property}{sides}-{breakpoint}-{size} для sm, md, lg, xl, и xxl.
Где объект недвижимости относится к одному из следующих типов:- m- для классов, которые устанавливают margin
- p- для классов, которые устанавливают padding
- t - for classes that set margin-top or padding-top
- b - for classes that set margin-bottom or padding-bottom
- s - (start) for classes that set margin-left or padding-left in LTR, margin-right or padding-right in RTL
- e - (end) for classes that set margin-right or padding-right in LTR, margin-left or padding-left in RTL
- x - for classes that set both *-left and *-right
- y - for classes that set both *-top and *-bottom
- пустое поле - для классов, которые задают значение margin или padding со всех 4 сторон элемента
- 0 - for classes that eliminate the margin or padding by setting it to 0
- 1 - (by default) for classes that set the margin or padding to $spacer * .25
- 2 - (by default) for classes that set the margin or padding to $spacer * .5
- 3 - (by default) for classes that set the margin or padding to $spacer
- 4 - (by default) for classes that set the margin or padding to $spacer * 1.5
- 5 - (by default) for classes that set the margin or padding to $spacer * 3
- auto - for classes that set the margin to auto
Examples
Here are some representative examples of these classes:
.mt-0 {
margin-top: 0 !important;
}
.ms-1 {
margin-left: ($spacer * .25) !important;
}
.px-2 {
padding-left: ($spacer * .5) !important;
padding-right: ($spacer * .5) !important;
}
.p-3 {
padding: $spacer !important;
}
Фоновое изображение Gantry 5 no-repeat (css)
/* section-background - победил повторяемость background-repeat */
.section-background {
background-repeat: no-repeat;
background-position: top center;
}