简体   繁体   English

第一个孩子的CSS没有得到应用

[英]CSS for first-child is not getting applied

I need to increase the height of the 1st panel which is in ng-repeat 我需要增加ng-repeat中的第一个面板的高度

Code

<div class="panel panel-default panel-height" ng-repeat="candidateInfo in aCandidateDetails">
<div class="panel-heading">
    <div class="row">
        <div class="col-xs-1">
            <a style="cursor:pointer">
                {{candidateInfo.name}}
            </a>
        </div>
    </div>
    <div stop-watch time="xyz" name="candidateInfo.name" time-of-interview="candidateInfo.doi" ></div>
</div>

Here i have applied css to the class .panel-height as below 在这里我将css应用于类.panel-height,如下所示

.panel-height:first-child {
    height: 500px;
}

Here the css is not getting applied , I cannot figure out where im going wrong . 这里的css没有得到应用,我无法弄清楚我哪里出错了。 Any help would be appreciated. 任何帮助,将不胜感激。

Add a class to 'panel-heading' only when the div satisfies $first and then add height to the class name 'firstChild'. 仅当div满足$ first时,才将类添加到“ panel-heading”中,然后将高度添加到类名“ firstChild”中。

 <div class="panel panel-default panel-height" ng-repeat="candidateInfo in aCandidateDetails"> <div class="panel-heading" ng-class="{'firstChild':$first}"> <!-- Try this line --> <div class="row"> <div class="col-xs-1"> <a style="cursor:pointer"> {{candidateInfo.name}} </a> </div> </div> <div stop-watch time="xyz" name="candidateInfo.name" time-of-interview="candidateInfo.doi" ></div> </div> 

It should work, well try this, 应该可以,请尝试一下,

.panel-height:nth-child(1) {
    height: 500px;
    background:#ccc;
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM