【问题标题】:How to change Bootstrap progress bar width with {{$percentage}} variable value in style Laravel?如何使用 Laravel 样式中的 {{$percentage}} 变量值更改 Bootstrap 进度条宽度?
【发布时间】:2020-10-11 05:12:06
【问题描述】:

我正在做一些项目,我想显示使用进度条获得的分数的百分比。

我有百分比值,我想以样式传递这个值:“宽度:{{$percentage}}”,以便进度条宽度根据获得的标记而变化,但它不起作用。这是我的代码:

请看 $percentage 在表格数据的末尾->{{round($percentage, 2)}}

<tr>
                                  <td>1</td>
                                  <td>{{$q->name}}</td>
                                  <td>{{$totalQuestions}}</td>
                                  <td>{{$attemptQuestions}}</td>
                                  <td>{{$userCorrectAnswer}}</td>
                                  <td>{{$userWrongAnswer}}</td>
                                  <td>{{round($percentage, 2)}}</td>
                                </tr>

                                @endforeach
                                
                              </tbody>
                            </table>

                            <p>
                                <strong>Percentage</strong> <span class="pull-right small muted">{{round($percentage, 2)}}</span>
                                
                            </p>

                             <div class="progress">

                        <div class="progress-bar" role="progressbar" aria-valuenow="{{$percentage}}" aria-valuemin="0" aria-valuemax="100" style="width : {{$percentage}}">
                              
                                <span class="sr-only">{{round($percentage, 2)}} Obtained</span>

                              </div>

【问题讨论】:

    标签: html css laravel bootstrap-4


    【解决方案1】:

    你需要像这样在样式中添加%

    style="width : {{$percentage}}%"
    

    【讨论】:

      【解决方案2】:

      您是否尝试过让进度条 div 没有任何内容?试试把div放在外面

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2014-03-10
        • 1970-01-01
        • 2018-09-12
        • 1970-01-01
        • 1970-01-01
        • 2012-09-17
        相关资源
        最近更新 更多