4Manuals

  • PDF Cloud HOME

CSS在像素中设置多个颜色渐变? Download

    具有Iframe表单的HTML文件,使用框架外的按钮通过JQuery提交表单按钮 CSS / JS-如何覆盖一个孩子而不是其他孩子的父母过渡 创建一个没有固定布局的HTML表,设置最大宽度,并且行不换行但溢出:隐藏 如何将动态值传递给渐变xml 在ajax调用成功之后添加文本区域 IntersectionObserver观察视口中的document.body上边缘 如何在网站上模拟JavaScript控制台? 使JPG图像适合SVG图像 如何在JS中强制重绘以进行CSS过渡? 可以在网站上播放几个不同的音乐文件

如何在y轴坐标1、2、3、4、5和6上从上到下绘制6种不同的颜色,这些颜色各占1 px,第7种颜色占股利的其余部分?我已经尝试过了,但是不起作用:

background-image: linear-gradient(to bottom, #e2e2e2 0%, #e8e8e8 2px, #efefef 3px, #f4f4f4 4px, #f7f7f7 5px, #f8f8f8 6px, #f9f9f9 100%);

3 个答案:

答案 0 :(得分:1)

尝试如下:

html {
 min-height:100%;
 background-image: 
  linear-gradient(to bottom, 
    orange  0 10px, 
    red     0 20px, 
    purple  0 30px, 
    green   0 40px, 
    #f7f7f7 0 50px, 
    blue    0 60px, 
    yellow 0);
}

或者如果您想要淡入淡出的过渡,则这样

html {
 min-height:100%;
 background-image: 
  linear-gradient(to bottom, 
    orange  10px, 
    red     20px, 
    purple  30px, 
    green   40px, 
    #f7f7f7 50px, 
    blue    60px, 
    yellow  0);
}

另一个具有多个渐变的想法:

html {
 min-height:100%;
 background: 
  linear-gradient(to bottom, 
    orange  , 
    red     , 
    purple  , 
    green   , 
    #f7f7f7 , 
    blue    ) top/100% 25% no-repeat, /* 25% = height */
   yellow;
}

答案 1 :(得分:1)

你去了

#grad1 {
    height: 200px;
    background: red; /* For browsers that do not support gradients */
    background: -webkit-linear-gradient(bottom, orange , yellow, green, cyan, blue, violet); /* For Safari 5.1 to 6.0 */
    background: -o-linear-gradient(bottom, orange, yellow, green, cyan, blue, violet); /* For Opera 11.1 to 12.0 */
    background: -moz-linear-gradient(bottom, orange, yellow, green, cyan, blue, violet); /* For Firefox 3.6 to 15 */
    background: linear-gradient(to bottom, orange , yellow, green, cyan, blue, violet); /* Standard syntax (must be last) */
}
<div id="grad1"></div>

答案 2 :(得分:0)

尝试一下:

div {
  background: #466368;
  background: linear-gradient(to right, #e2e2e2 40px, #f8f8f8 50%, #e8e8e8 10%, #293f50 );
  border-radius: 6px;
  height: 120px;
}
<div></div>



Similar searches
    如何更改角度材质的选择样式? Gson fromJson()与来自OkHttp3的有效Json响应不起作用 如何处理同一C#类的编码和解码版本 将多个数据参数传递给Bootstrap模式 错误:组件选择器只能与babel-plugin-emotion结合使用。尝试使用情感和CRA设置复选框样式时