Making gradient background fill page with css

后端 未结 7 1169
醉酒成梦
醉酒成梦 2020-12-14 01:22

I have this gradient background but I don\'t want it to repeat the way it does to fill the page, I want it to be one large gradient that fills the page.

html:

<
7条回答
  •  抹茶落季
    2020-12-14 01:41

    This is a great answer for this: https://css-tricks.com/perfect-full-page-background-image/

    html {
      background: linear-gradient(-60deg, #23e2cb 30%, black 30%), transparent 0;
      background-repeat:no-repeat;
      min-height: 100%;
      min-width: 1024px;
    
      width: 100%;
      height: auto;
    }
    

    -60deg So it puts a 120 degree angle (a bit like that -> / ) on the right side of my page, hence the minus and puts it at 30% of the page from the right side with the colour #23e2cb. So I am setting the other colour to black with a gradient of 30% so the line stays defined. If I set the black to 40% there is no definition in the line, it uses that extra 10% to gradually change from black to blue.

提交回复
热议问题