Extend background gradient across body without background-attachment: fixed

后端 未结 2 564
闹比i
闹比i 2021-01-01 05:16

I want to have a background gradient, e.g.

background: linear-gradient(to bottom, rgba(0, 0, 0, 0.3), rgba(2, 126, 174, 0.9))

on the body

2条回答
  •  [愿得一人]
    2021-01-01 05:33

    Thy this ( add any background-size you need):

    body
    {
    background: linear-gradient(to bottom, rgba(0, 0, 0, 0.3), rgba(2, 126, 174, 0.9));
          background-attachment: scroll;
        background-size: 100% 900px;
        overflow: hidden;
    }
    

    Here's the fiddle: http://jsfiddle.net/BfH8D/1/

    Is this the result you want?

提交回复
热议问题