我想要恰好 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;">
最佳答案
这些是你问题的答案
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%);
}
<hr style="height:10px;">
<hr style="height:10px;" class="hr2">
关于html - 如何为我的 hr 标签获取渐变边框,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39599263/