Create a div with bottom half one color and top half another color

前端 未结 2 1565
说谎
说谎 2021-01-04 03:22

I have a which I am going to make into a button. The top half should be #ffd41a and the bottom half should be #fac915. Here is a link to the button at present. http://jsfid

2条回答
  •  隐瞒了意图╮
    2021-01-04 04:10

    CSS3 provides a way to do this

    background-image: linear-gradient(bottom, #FFD51A 50%, #FAC815 50%);
    background-image: -o-linear-gradient(bottom, #FFD51A 50%, #FAC815 50%);
    background-image: -moz-linear-gradient(bottom, #FFD51A 50%, #FAC815 50%);
    background-image: -webkit-linear-gradient(bottom, #FFD51A 50%, #FAC815 50%);
    background-image: -ms-linear-gradient(bottom, #FFD51A 50%, #FAC815 50%);
    

    http://jsfiddle.net/WnwNW/1/

提交回复
热议问题