I would like some full sized slanted stripes on the page; that’s all.
This is what I did so far:
html, body {
overflow-x: hidden;
margin: 0;
padding: 0;
}
body {
display: flex;
margin: 0;
padding: 0;
}
.flag-strip {
position: absolute;
width: 100vw;
height: 15px;
left: 0;
transform: rotate(-10deg);
z-index: 1;
}
.flag-strip.red {
background-color: #D90012;
top: 9%;
}
.flag-strip.blue {
background-color: #0033A0;
top: 10.5%;
}
.flag-strip.orange {
background-color: #F2A800;
top: 12%;
}
@media (max-width: 878px) {
.flag-strip.red {
top: 11%;
}
.flag-strip.blue {
top: 12.5%;
}
.flag-strip.orange {
top: 14%;
}
}
<div class="flag-strip red"></div>
<div class="flag-strip blue"></div>
<div class="flag-strip orange"></div>
But the user shouldn’t have a horizontal scroll bar, and the stripes should be really full sized — there shouldn’t be any endings visible on the page.
How can I make it work like that?
2
Answers
For the visible endings at either side, you could make the
.flag-strip
extra-wide (like 120vw) and instead of starting atleft:0
you could start it 20px off the view (i.e. -20px) – see below:if you do not want any scrollbars, you can also make the
.body
hide the overflow in both directions (not just X)See runnable demo:
You can do this entirely in CSS with
linear-gradient
as the background.