Я хочу сделать цвет фона по краю для столбца внутри фиксированного контейнера. У меня есть пример здесь . Как мне этого добиться?
Я пробовал это, но ни один из них не работал ...
Первый:
@import '~bootstrap/scss/variables';
@import '~bootstrap/scss/bootstrap-grid';
@import '~bootstrap/scss/mixins';
// Apply this class to elements which should have breakout backgrounds
.breakout-background {
position: relative; // establish breakout positioning ancestor
z-index: 0; // establish stacking context for breakout
// Breakout background pseudo element
&:before {
content:'';
position: absolute;
height: 100%;
top:0;
width: 100vw; // Takes up 100% of the viewport width
z-index: -1; // pseudo element is behind its parent
background-color: blue;
// Different left position for each breakpoint
@each $breakpoint, $container-max-width in $container-max-widths {
@include media-breakpoint-up($breakpoint, $grid-breakpoints) {
// Position -50% of viewport width, then readjust right again half the grid container width
left: calc(-100vw / 2 + #{$container-max-width} / 2)
}
}
}
}
Второй:
.breakout-background {
&:before {
content: "";
background-color: #322529;
z-index: -1;
right: 0px;
width: 1000px;
height: 60%;
top: 35%;
position: absolute;
}
}
Третье:
.breakout-background {
margin: 0 -9999rem;
padding: 0.25rem 9999rem;
background: rgba(0, 0, 0, 0.5);
}