使用渐变但不混合颜色 [英] using gradient but without mixing color

查看:62
本文介绍了使用渐变但不混合颜色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我不知道这是一个愚蠢的问题还是类似的问题,但是我希望div用一种颜色填充一定的百分比,而用其他颜色填充其余的百分比.

I don't know if that is a stupid question or something like that but i want a div to be filled certain percent by one color and remaining part by other.

还有渐变属性

.div{
     background: linear-gradient(to right, #000 50%, #fff 50%);
}

结果进入

.div{
     background: linear-gradient(to right, #000 28%, #fff 72%);
}

结果变为

我想让白色和黑色不要混在一起,并且在所有百分比上都要分开.

i want to get the white and black not to mix and be seperated on all percentages.

推荐答案

尝试一下

.div{
    background: -webkit-linear-gradient(left, black 50%, white 0%);
    background: -moz-linear-gradient(left, black 50%, white 0%);
    background: -ms-linear-gradient(left, black 50%, white 0%);
    background: linear-gradient(left, black 50%, white 0%);
}

这篇关于使用渐变但不混合颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆