douyi02577 2016-07-26 14:48
浏览 159

Laravel / PHP行特定颜色

Working in Laravel 4.2, how can I change the color of a single row? I want to make it grey or whatever but I don't know the syntax in order to change it. I don't want to change the entire page, just one row within my project.

    {{ HTML::row() }}
    {{ HTML::col(3,3,3,3) }}
    {{ Form::formGroup() }}
    {{ Form::label('RecordID', 'Record ID') }}
    {{ Form::text('RecordID', $Appinfo->RecordID, ['class' => 'form-control', 'data-fv-notempty' => 'true', 'readonly']) }}
    {{ Form::closeFormGroup() }}
    {{ HTML::closeCol() }}
    {{ Form::formGroup()}}
    {{ HTML::closeRow() }}
  • 写回答

1条回答 默认 最新

  • douliang9057 2016-07-26 16:46
    关注

    You have a couple of options for how you can achieve this.

    CSS Method

    You can use CSS pseudo selectors to style only the last row:

    .class-of-parent-element .row:last-child {
        background-color: #e3e3e3;
    }
    

    Please note that this will only work if the row is actually the last element inside its parent.

    Laravel Method

    Assuming that your template already knows that this is the last row (this is unclear from the code sample you supplied) you an assign a class to the row. HTML::row() probably accepts an attributes argument, in which case using something like HTML::row(['class' => 'last-row']); should allow you to style it through a specific class. Failing this it may be easier to write the row HTML yourself and give it your own class.

    <div class="row last-row">
        {{ HTML::col(3,3,3,3) }}
        {{ Form::formGroup() }}
        {{ Form::label('RecordID', 'Record ID') }}
        {{ Form::text('RecordID', $Appinfo->RecordID, ['class' => 'form-control', 'data-fv-notempty' => 'true', 'readonly']) }}
        {{ Form::closeFormGroup() }}
        {{ HTML::closeCol() }}
        {{ Form::formGroup()}}
    </div>
    
    评论

报告相同问题?

悬赏问题

  • ¥15 c程序不知道为什么得不到结果
  • ¥40 复杂的限制性的商函数处理
  • ¥15 程序不包含适用于入口点的静态Main方法
  • ¥15 素材场景中光线烘焙后灯光失效
  • ¥15 请教一下各位,为什么我这个没有实现模拟点击
  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置