我正在尝试对列表中的第一个元素应用不同的样式。
我目前正在尝试使用计数器来应用liwith a class,cnt==0但我不能在标签中包含< >括号。OutputText有什么方法可以转义括号或使用条件将其class插入标签中?<li>
我知道这可以在使用 JavaScript 之后完成,但我宁愿避免它。
<apex:variable var="cnt" value="{!0}" />
<apex:repeat value="{!items}" var="item" >
<!-- only render the class if it is the first element -->
<apex:OutputText value="<li class="activeLI">" rendered="{!cnt==0}" />
<apex:OutputText value="<li>" rendered="{!cnt!=0}" />
<img src="{!$Resource[item.Image__c]}" width="85" height="90"/>
</li>
<apex:variable var="cnt" value="{!cnt+1}"/>
</apex:repeat>