进度条 - 如何添加标记/标线

时间:2018-01-14 14:34:01

标签: html5 twitter-bootstrap css3 bootstrap-4

我在Bootstrap中有一个垂直进度条(在React组件中实现),我想在其上放置水平标记。换句话说,现在条形填充到当前预期的产量,我还想在进度条上用水平线标记目标产量。有什么想法吗?

<div className="w-25 m-1">
                <div className="progress progress-bar-vertical ">
                    <div
                        className="progress-bar"
                        role="progressbar"
                        aria-valuenow={yieldInKG}
                        aria-valuemin="0"
                        aria-valuemax={maxValue}
                        style={{ height: '{ barHeight }%' }}>
                        <span>{percentage}%</span>
                    </div>
                </div>
            </div>

1 个答案:

答案 0 :(得分:0)

编辑:下面的代码可以单独使用本机Bootstrap类来完成工作。您可以尝试bg-light类而不是bg-secondary

以下是代码:

&#13;
&#13;
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta.3/css/bootstrap.min.css" integrity="sha384-Zug+QiDoJOrZ5t4lssLdxGhVrurbmBWopoEl+M6BdEfwnCJZtKxi1KgxUyJq13dy" crossorigin="anonymous">


    <div class="progress progress-bar-vertical">
    <div class="progress-bar" role="progressbar" style="width: 25%;" aria-valuenow="25" aria-valuemin="0" aria-valuemax="100">25%</div>
    <div class="progress-bar bg-light" role="progressbar" style="width: 30%" aria-valuenow="30" aria-valuemin="0" aria-valuemax="100"></div>
    <div class="progress-bar bg-primary" role="progressbar" style="width: .3%"></div>
</div>


<script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js" integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q" crossorigin="anonymous"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta.3/js/bootstrap.min.js" integrity="sha384-a5N7Y/aK3qNeh15eJKGWxsqtnX/wWdSZSKp+81YjTmS15nvnvxKHuzaWwXHDli+4" crossorigin="anonymous"></script>
&#13;
&#13;
&#13;