我希望完全 50%的红色并保留任何其他颜色。我是网页设计的新手,请帮助我。
hr{
background: red;
background: -webkit-linear-gradient(red, yellow);
background: -o-linear-gradient(red, yellow);
background: -moz-linear-gradient(red, yellow);
background: linear-gradient(red, yellow);
}
<hr style="width:100%; height:5px;">
答案 0 :(得分:4)
这些是您的问题的答案
hr{ background: red; /* For browsers that do not support gradients */
background: -webkit-linear-gradient(left, red , yellow); /*For Safari 5.1 to 6.0 */
background: -o-linear-gradient(right, red, yellow); /* For Opera 11.1 to 12.0 */
background: -moz-linear-gradient(right, red, yellow); /* For Firefox 3.6 to 15 */
background: linear-gradient(to right, red , yellow); /* Standard syntax */ }
.hr2{
height: 25px;
background: red;
background: -webkit-linear-gradient(red 50%, yellow 50%);
background: -o-linear-gradient(red 50%, yellow 50%);
background: -moz-linear-gradient(red 50%, yellow 50%);
background: linear-gradient(red 50%, yellow 50%);
}
&#13;
<hr style="height:10px;">
<hr style="height:10px;" class="hr2">
&#13;
答案 1 :(得分:2)
hr{
height: 20px;
background: red;
background: -webkit-linear-gradient(red 50%, yellow 50%);
background: -o-linear-gradient(red 50%, yellow 50%);
background: -moz-linear-gradient(red 50%, yellow 50%);
background: linear-gradient(red 50%, yellow 50%);
}
<hr>
答案 2 :(得分:0)
hr{
height: 30px; /*Choose your required size*/
background: red;
background: -webkit-linear-gradient(left, red , blue);
background: -o-linear-gradient(right, red, blue);
background: -moz-linear-gradient(right, red, blue);
background: linear-gradient(to right, red , blue);
}