I want to set this background to my html webpage. This background splits the screen in two colors with one line that goes from upper right corner to one point of the horizontal bottom line. It does not split it from corner to corner. The thing is that I want to do it in a responsive way. For example, the line could start in the 25% of the bottom length to the top right corner. I all screens, without scroll bars. Something Like this:
I have tried this:
body{
width: 100%;
height: 114vh;
background: linear-gradient(to right bottom, white 50%, blue 50.1%);
background-size: 100%;
background-position: center center;
margin: 0;
padding: 0;
}
But it is not responsive. Not in all screens the screen is split in the same way and some scrolls appear.
3
Answers
Does this answer you question?
You can put the background on a before pseudo element and use clip path to cut it to the right shape, using % offsets so it is responsive.
For example:
It depends on whether you want the triangle to be fixed in the screen or not as to whether you position the pseudo element fixed or absolute.
Don’t play with body height, play with the
background-size